<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 蚌埠天气 - 第2个互联网数据源的天气预报 <% response.write "
" 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 Function BytesToBstr(body) 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 = "GB2312" '转换原来默认的UTF-8编码转换成GB2312编码,否则直接用XMLHTTP组件调用有中文字符的网页得到的将是乱码 BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function Dim Url,StrBK,sRart,oVer,RsBK Url="http://www.tq121.com.cn/travel/travelcity.php?index=1&id=58221" StrBK=getHTTPPage(URL) start=Instr(StrBK,"") over=Instr(StrBK,"
发布时间") RsBK=mid(StrBK,start,over-start) response.write(RsBK) response.write "
" %>