http://community.111cn.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
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.