注册 | 登陆
您的位置:阿里西西 > 编程技术 > ASP教程 > 详细内容

如何通过XMLHTTP获取web访问头信息和网页代码

  稿源:互联网   2018-09-15 01:15:13   点击:   撤稿纠错
如何通过XMLHTTP获取web访问头信息和网页代码的一段实例代码。

以下讨论的是和XMLHTTP 头信息相关的如何通过XMLHTTP获取web访问头信息和网页代码 教程文章,内容是本站精心挑选整理的教程,希望对广大的网友给到帮助,下面是详细内容:

第一段代码是后台的程序代码:

[code]<%

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

url=request.form("url")
if trim(url)<>"" then
    set xml = Server.CreateObject("MSXML2.XMLHTTP.5.0")
    xml.open "GET",url, False
    xml.send
    bo = BytesToBstr(xml.ResponseBody,"UTF-8")
    header = xml.GetAllResponseHeaders
    set xml = nothing
end if

%>
[/code]

下面是前端HTML文件:

[code]
XMLHTTP测试


   
       
           
               
           
       
       
           
       
       
           
       
   

               
               

           

           

[/code]

 


关于如何通过XMLHTTP获取web访问头信息和网页代码的内容写到这里就结束啦,您可以收藏本页网址http://www.alixixi.com/biancheng/ a/2018091548509.shtml方便下次再访问哦。