如何读取其它网站的网页内容?

王朝other·作者佚名  2006-01-09
宽屏版  字体: |||超大  

如何读取其它网站的网页内容?

抓取网页内容的方法有好多种,从最基本的基于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

%>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有