Weather forecast http://community.csdn.net/Expert/topic/3720/3720043.xml?temp=.9098169
<form method=post action= "weareport.asp" >
City: <input name=city value= ' Harbin ' ><br/>
Area: <input name=area value= ' ne ' ><br/>
Province: <input name=province value= ' Heilongjiang ' ><br/>
<input type=submit value= ' View ' >
</form>
<%
If Request ("City") <> "then"
City=request ("City")
Area=request ("area")
Province=request ("province")
Contents=gethttppage ("http://www.cma.gov.cn/netcenter_news/qxyb/city/index.php?city=" &city& "& Province= "&province&" &area= "&area)
Startpos=cutedpage (contents, "<!--weather forecast Start-->", 1)
Endpos=cutedpage (contents, "<!--weather forecast End-->", 0)
Contents=mid (Contents,startpos,endpos-startpos)
Contents=replace (contents, "src=/", "src=http://www.cma.gov.cn/")
Contents=replace (contents, "Src= ...", "src=http://www.cma.gov.cn/netcenter_news/qxyb/city/...")
Response.Write Contents
End If
function Cutedpage (Scontent,str,mode)
If scontent= "" Then Exit function
Pos=instr (SCONTENT,STR)
If Pos>=0 Then
If Mode=0 Then
Cutedpage=pos
Else
Cutedpage=pos+len (str)
End If
Else
Cutepage=len (scontent)
End If
End Function
Function BYTES2BSTR2 (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
BYTES2BSTR2 = objstream. ReadText
Objstream. Close
Set objstream = Nothing
End Function
function gethttppage (URL)
On Error Resume Next
Dim http
Set Http=server.createobject ("Microsoft.XMLHTTP")
Http.open "Get", Url,false
Http.send ()
If Http.readystate<>4 then Exit function
GETHTTPPAGE=BYTES2BSTR2 (Http.responsebody, "GB2312")
Set http=nothing
If Err.number<>0 then err. Clear
End Function
%>