1,451
社区成员
发帖
与我相关
我的任务
分享
Function testxml() 'ajax读取页面信息返回是数据流
Set retrieval = Server.CreateObject("Microsoft.XMLHTTP")
url = "http://www.baidu.com"
wr.Write url
' wr.End
retrieval.Open "GET", url, False
retrieval.send
wr.Write BytesToBstr(retrieval.wrBody, code) '成功获取网页源码!
End Function
Function BytesToBstr(body, code) '把数据流转换成文本
Dim objStream
Set objStream = New adodb.Stream
objStream.Type = 1
objStream.Mode = 3
objStream.Open
objStream.Write body
objStream.Position = 0
objStream.Type = 2
objStream.Charset = code
BytesToBstr = objStream.ReadText
objStream.Close
Set objStream = Nothing
End Function