<!--#include file="../../conn.asp"-->

<%Call head()
Call saycarda("天气查询")
dim sid
sid=request.querystring("sid")
On Error Resume Next
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
t = GETBody(Path)       
End function
function getHTTPPage(url) 
dim Http 
set Http=server.createobject("Microsoft.XMLHTTP") 
Http.open "GET",url,false 
Http.send() 
if Http.readystate<>4 then 
exit function 
end if 
getHTTPPage=bytesToBSTR(Http.responseBody,"utf-8") '注意WAP网页用utf-8,WEB用gb2312
set http=nothing 
if err.number<>0 then err.Clear 
end function 
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 
dim urll,city
urll=request.querystring("url")
city=request.querystring("city")
Dim Url,Html,start,over,body,wap,wstr,str
Url="http://qq.ip138.com/weather/"&urll&"/"&city&".wml"
wstr=getHTTPPage(url)            
start=Instr(wstr,"<p>")
over=Instr(wstr,"<br/><a href=""/weather/weather_prov.wml"">&gt;按省份查询天气</a><br/>")

body=mid(wstr,start,over-start)

body = replace(body,"</td>","")
body = replace(body,"<td>","")
body = replace(body,"</tr>","<br/>")
body = replace(body,"<tr>","")
body = replace(body,"<br/><br/><br/><b>","<br/><br/><b>")
body = replace(body,"</p>","")
body = replace(body,"<p>","")

if body="" then
Response.Write "很遗憾.无法为您的获取天气情况,<a href='index.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;znzn520="&znzn520&"'>重新查询</a><br/>"
else
Response.write body
end if
%>
<a href='index.asp?sid=<%=sid%>&amp;znzn520=<%=znzn520%>'>天气首页</a><br/>
<%response.write "<a href=""../index.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;znzn520="&znzn520&""">返回上级</a>"
response.write "<br/><a href=""/index.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;znzn520="&znzn520&""">网站首页</a><br/>"
response.write"<img src='/foryou/clock.gif' alt='.'/>"&Month(Now)&"月"&Day(Now)&"日"&FormatDateTime(Now,vbshortTime)&""
Call headsay()
%>
