« 网站生成静态页面,及网站数据采集的攻、防原理和策略delphi ado 动态连接数据库 »

asp获取网页源代码

<%
dim fso
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

Function GetBody(weburl)

    '创建对象

    Dim ObjXMLHTTP

    Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")

    '请求文件,以异步形式

    ObjXMLHTTP.Open "GET",weburl,False

    ObjXMLHTTP.send

    While ObjXMLHTTP.readyState <> 4

        ObjXMLHTTP.waitForResponse 1000

    Wend

    '得到结果

     GetBody=ObjXMLHTTP.responseBody

    '释放对象

     Set ObjXMLHTTP=Nothing

End Function
response.write BytesToBstr(GetBody("http://www.baidu.com/"),"gb2312") 


function jt()
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
end function
%>

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

网站目录

最近发表

最新评论及回复

文章归档

Search

Powered By Z-Blog 1.8 Terminator(beta) Build 71218 Designed by Michael

Copyright 0-9999 subin.org.cn Rights Reserved. 晋ICP备08000685号