set xml=server.createobject("Microsoft.XMLHTTP")
xml.Open "GET", "www.163.com", False
' Pull the data from the web page
xml.Send
set oStream = server.CreateObject("ADODB.Stream")
oStream.Type=1
oStream.Mode=3
oStream.Open()
oStream.Write(xml.responseBody)
oStream.Position= 0
oStream.Type= 2
oStream.Charset="utf-8"
'result= oStream.ReadText()
oStream.SaveToFile(server.mappath("aa.doc"))
oStream.Close()
set oStream = nothing
'Response.write(result)
'response.Redirect "aa.xls"
Set xml = Nothing

博客展示了使用XML获取网页数据的代码。通过创建Microsoft.XMLHTTP对象,向www.163.com发送GET请求获取数据,再利用ADODB.Stream对象将响应数据保存为aa.doc文件,最后释放相关对象。
1万+

被折叠的 条评论
为什么被折叠?



