如何读取其它网站的网页内容?
抓取网页内容的方法有好多种,从最基本的基于Socket和Http协议的网络接口
到利用一些现成的组件,比如windows internet transfer control控件。
这里,我想说一下MSXML对象库。
Msxml对象默认应该是安装在win2000系统上的吧,
其基本的使用方式如下:
1
2url = " http://blog.csdn.net/cqq "
3set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
4xmlhttp.open "GET", url, false
5xmlhttp.send ""
6Response.write xmlhttp.responseText
7set xmlhttp = nothing
如果url地址不正确的话,
就回返回这样的错误信息:
msxml4.dll (0x80072EE7)
Server name or address could not be resolved
当然也可以通过xmlhttp对象post数据,
1
2url = " http://blog.csdn.net/cqq "
3set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
4xmlhttp.open "POST", url, false
5xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
6xmlhttp.send "x=1&y=2"
7Response.write xmlhttp.responseText
8set xmlhttp = nothing