'//1、输入url目标网页地址,返回值getHTTPPage是目标网页的html代码Function getHTTPPage(url)url=cstr(url)dim Httpset Http=server.createobject("MSXML2.ServerXMLHTTP")' Response.write url' Response.endCall Http.setTimeouts(90000,90000,90000,90000)Http.open "GET",url,falseHttp.send()if Http.readystate<>4 thenexit functionend ifgetHTTPPage=bytesToBSTR(Http.responseBody,"utf-8")set http=nothingif err.number<>0 then err.ClearEnd Function'//2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换Function BytesToBstr(body,Cset)dim objstreamset objstream = Server.CreateObject("adodb.stream")objstream.Type = 1objstream.Mode =3objstream.Openobjstream.Position = 0objstream.Type = 2objstream.Charset = CsetBytesToBstr = objstream.ReadTextobjstream.Closeset objstream = nothingEnd Function
相关文章: