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

|