28,405
社区成员
发帖
与我相关
我的任务
分享
Function GetHTTPPage(url)
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
Set Http=Nothing
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
End Function
Function 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
d1="http://www.baidu.com"
d2=server.mappath("/head.html")
response.write "<div>111111</div>"
myHeadData=GetHTTPPage(d3)
response.write "<div>22222</div>"
response.write myHeadData
If myHeadData="" then
response.write "<div>333333</div>"
End If