The URL for obtaining the 72-hour weather forecast is:
Http://weather.all2rss.com/
For example:
The weather forecast for Shenzhen is:
Http://weather.all2rss.com/weatherrss.asp? City =% C9 % ee % db % da(Note: The red part can be replaced with the appropriate city HTML code)
RSS data is:
<? XML version = "1.0" encoding = "gb2312"?> <RSS version = "2.0"> <channel> <title> 72-hour Weather Forecast in Shenzhen </title> <description> 72-hour Weather Forecast in Shenzhen </description> <copyright/> <language> en-CN </language> <lastbuilddate> 9:15:11 </lastbuilddate> <link> http://weather.all2rss.com/</link> <TTL> 30 </TTL> <item> <title> <! [CDATA [October 11-today: light rain 25 ℃ ~ 29 ℃ breeze is less than 3 levels; tomorrow: Cloudy 25 ℃ ~ 29 ℃ breeze is less than 3; The Day After Tomorrow: Cloudy 25 ℃ ~ 29 ℃ breeze less than 3 levels]> </title> <link> <! [CDATA [http://weather.all2rss.com/city.asp? Id = 219 & City = Shenzhen & date = 2010-10-11-]> </link> <description> <! [CDATA []> </description> <author> </author> <pubdate> Mon, 11 Oct 2010 09:15:11 + 0800 </pubdate> </item> </channel> </RSS>
Then extract the corresponding data using the relevant programming language.
For example, get the weather forecast (ASP) code within three days:
// Getweather. asp
<% @ Language = "VBScript" codePage = "936" %>
<%
Dim ml
ML = ML & "<meta http-equiv =" "Content-Type" "content =" "text/html; charset = gb2312" "/>"
ML = ML & "<meta http-equiv =" "X-UA-compatible" "content =" "Ie = 7" "/>"
'Response. Write ("document. Write ('" & ml &"');")
Function readrss (xmlseed)
Dim xmldoc
Dim HTTP
Set HTTP = server. Createobject ("Microsoft. XMLHTTP ")
HTTP. Open "get", xmlseed, false
HTTP. Send
Set xmldoc = server. Createobject ("Microsoft. xmldom ")
Xmldoc. async = false
Xmldoc. validateonparse = false
Xmldoc. Load (HTTP. responsexml)
Dim result
If xmldoc. readystate> 2 then
Set lastbuilddate = xmldoc. getelementsbytagname ("lastbuilddate ")
Dim channel_link
Set channellink = xmldoc. selectsinglenode ("// channel/Link ")
Channel_link = channellink. Text
Dim lastdate
Lastdate = lastbuilddate. Item (0). Text
Set item = xmldoc. getelementsbytagname ("item ")
If item. length> 0 then
For I = 0 to (item. Length-1)
Set Title = item. Item (I). getelementsbytagname ("title ")
Set link = item. Item (I). getelementsbytagname ("Link ")
Result = Result & title. Item (0). Text
Next
End if
End if
Set xmldoc = nothing
Result = Replace (split (result, "-") (1 ),"","")
Result = Replace (result, "today", "<B> <font color =" red ""> today </font> </B> ")
Result = Replace (result, "Tomorrow", "<B> tomorrow </B> ")
Result = Replace (result, "The Day After Tomorrow", "<B> The Day After Tomorrow </B> ")
Readrss = Result
End Function
Response. Write ("document. Write ('" & readrss ("http://weather.all2rss.com/weatherrss.asp? City= % B4 % F3 % Cd % AC")&"');")
%>
Call method:
Save the above Code as getweather. asp and put it in a suitable directory (for example,/weather). Then insert the following code in a proper location on other webpages.
<Script language = "JavaScript" src = "/weather/getweather. asp" charset = "gb2312"> </SCRIPT>