'1、输入url目标网页地址,返回值gethttppage是目标网页的html代码 function gethttppage(url) dim http set http=server.createobject("msxml2.xmlhttp") http.open "get",url,false http.send() if http.readystate<>4 then exit function end if gethttppage=bytestobstr(http.responsebody,"gb2312") set http=nothing if err.number<>0 then err.clear end function
'2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换 function bytestobstr(body,cset) dim objstream set objstream = server.createobject("adodb.stream") objstream.type = 1 objstream.mode =3 objstream.open objstream.write body objstream.position = 0 objstream.type = 2 objstream.charset = cset bytestobstr = objstream.readtext objstream.close set objstream = nothing end function
'下面试着调用http://3doing.com/earticle/的html内容 dim url,html url="http://3doing.com/earticle/" html = gethttppage(url) response.write html %->