这样更加真实: <% dim url url=request.querystring("url") if url="" then response.write "no url" response.end end if dim Ds delaytime=0 '延时时间 Server.ScriptTimeOut=99999 Function getHTTPPage(Path) t = GetBody(Path) getHTTPPage=BytesToBstr(t,"GB2312") End functionFunction GetBody(url) on error resume next Set Retrieval = CreateObject("Microsoft.XMLHTTP")
Retrieval.Open "Get", url, False, "", "" Retrieval.Send If Err.Number = 0 Then '如果成功 Retrieval.ResponseBody = xmlHttp.responseText '等待从服务器接受数据 Else Retrieval.ResponseBody = "地址未发现" '错误信息 End If GetBody = Retrieval.ResponseBody
Set Retrieval = Nothing End FunctionFunction BytesToBstr(body,Cset) dim objstream set objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function
<%
dim url
url=request.querystring("url")
if url="" then
response.write "no url"
response.end
end if
dim Ds
delaytime=0 '延时时间
Server.ScriptTimeOut=99999
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
End functionFunction GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
Retrieval.Open "Get", url, False, "", ""
Retrieval.Send
If Err.Number = 0 Then '如果成功
Retrieval.ResponseBody = xmlHttp.responseText '等待从服务器接受数据
Else
Retrieval.ResponseBody = "地址未发现" '错误信息
End If
GetBody = Retrieval.ResponseBody
Set Retrieval = Nothing
End FunctionFunction BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
body=getHTTPPage(url)
%><%=body%>