首页 > 代码库 > asp发送http请求,获取一个url的内容
asp发送http请求,获取一个url的内容
response.Write("http://"&Request.ServerVariables("HTTP_HOST")&"/jfclear"&Request.ServerVariables("REQUEST_URI"))
Response.Write(GetHttpPage("http://www.baidu.com/","UTF-8"))
Function GetHttpPage(url, charset)
Dim http
Set http = Server.createobject("Msxml2.ServerXMLHTTP")
http.Open "GET", url, false
http.Send()
If http.readystate<>4 Then
Exit Function
End If
GetHttpPage = BytesToStr(http.ResponseBody, charset)
Set http = Nothing
End function
Function BytesToStr(body, charset)
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 = charset
BytesToStr = objStream.ReadText
objStream.Close
Set objStream = Nothing
End Function
asp发送http请求,获取一个url的内容
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。