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

<%Call head()
Call saycarda("天气查询")
dim sid
sid=request.querystring("sid")
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,"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,p
urll=request.querystring("url")
Dim Url,Html,body,body2,page2
Url="http://qq.ip138.com/weather/"&urll&"/index.htm"

body=getHTTPPage(url) 
         
start=Instr(body,"<table width=""420"" borderColorDark=""#ffffff"" borderColorLight=""#008000"" border=""1"" cellspacing=""0"" cellpadding=""1"">")
over=Instr(body,"<p align=""center"">请输入市")
body=mid(body,start,over-start)

body = replace(body,"</div>","</tr>")
body = replace(body,"</td>","")
body = replace(body,"<td>","")
body = replace(body,"</tr>","<br/>")
body = replace(body,"<tr>","")
body = replace(body,"</table>","")
body = replace(body,"</p>","")
body = replace(body,"<p>","")
body = replace(body,"/weather/"&urll&"/","view.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;vs="&vs&"&amp;url="&urll&"&amp;city=")
body = replace(body,".htm","")
body = replace(body,"<table width=""420"" borderColorDark=""#ffffff"" borderColorLight=""#008000"" border=""1"" cellspacing=""0"" cellpadding=""1"">","")

body = replace(body,"<div style=""padding:3px""><iframe src=""/jss/bd_460x60"" frameborder=""no"" width=""460"" height=""60"" border=""0"" marginwidth=""0"" marginheight=""0"" scrolling=""no""></iframe>","")
if body="" then
Response.Write "很遗憾.无法为您的获取天气情况,<a href='index.asp'>重新查询</a><br/>"
else
Response.write body
end if
%>
<a href='index.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>&amp;znzn520=<%=znzn520%>'>天气首页</a><br/>
<%response.write "<a href=""../index.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;vs="&vs&""">返回上级</a>"
response.write "<br/><a href=""/index.asp?sid="&sid&"&amp;saytk="&saytk&"&amp;vs="&vs&""">网站首页</a>"
Call headsay()
%>
