asp抓取网页内容<br />
<% <br />
function getHTTPPage(url,cset) <br />
dim Http <br />
set Http=server.createobject("MSXML2.XMLHTTP") <br />
Http.open "GET",url,false <br />
Http.send() <br />
if Http.readystate<>4 then exit function <br />
getHTTPPage=bytesToBSTR(Http.responseBody,cset) <br />
set http=nothing <br />
if err.number<>0 then err.Clear <br />
end function <br />
<br />
Function BytesToBstr(body,Cset) <br />
dim objstream <br />
set objstream = Server.CreateObject("adodb.stream") <br />
objstream.Type = 1 <br />
objstream.Mode =3 <br />
objstream.Open <br />
objstream.Write body <br />
objstream.Position = 0 <br />
objstream.Type = 2 <br />
objstream.Charset = Cset <br />
BytesToBstr = objstream.ReadText <br />
objstream.Close <br />
set objstream = nothing <br />
End Function <br />
<br />
response.write(getHTTPPage("http://www.baidu.com/","gb2312"))<br />
%>