- 精品下载 | 实用查询 | 词典查询 | 桌面壁纸 | 网址 | 笑话 | FLASH频道 | 天气文章资讯 | 站长工具 | 证件办理 | 闪字生成 | 广告代码 | 在线手册 | 有问必答
您现在的位置: 蓝派网 >> 文章中心 >> 网络编程 >> ASP >> 正文
站内文章搜索:           

asp远程读取网页源代码

作者:佚名    文章来源:本站原创    更新时间 :2007-11-23 11:17:13
'asp远程读取网页源代码
'读取数据
Function GetURL(URL)
Set http=Server.CreateObject("Microsoft.XMLHTTP")
     On Error Resume Next
     http.Open "GET",URL,False
     http.send()
     if Err then
     Err.Clear
     Response.Write("没有找到网页!")
     Response.End()
     End if
     getHTTPPage=bytesToBSTR(Http.responseBody,"gb2312")
set http=nothing
GetURL=getHTTPPage
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
'调用方法
Content=GetURL(http://www.lan27.com)
Response.Write(Content)

发表评论】【打印此文】【关闭窗口】【点击数:
★好玩的休闲小游戏★
网友评论:
数据载入中,请稍后……