<rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss
+/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<title>Yahoo! Weather - Error</title>
<description>Yahoo! Weather Error</description>
<item>
<title>City not found</title>
<description> Invalid Input /forecastrss?p=60642&u=F</description>
</item>
</channel>
</rss><!-- api2.weather.ac4.yahoo.com compressed/chunked Sun Jul 19 22
+:10:00 PDT 2009 -->
I tied the same for other zipcode (60641) and got following
<rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss
+/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<channel>
<title>Yahoo! Weather - Chicago, IL</title>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Chicago__IL/*http:/
+/weather.yahoo.com/forecast/USIL0225_f.html</link>
<description>Yahoo! Weather for Chicago, IL</description>
<language>en-us</language>
<lastBuildDate>Sun, 19 Jul 2009 11:51 pm CDT</lastBuildDate>
<ttl>60</ttl>
<yweather:location city="Chicago" region="IL" country="US"/>
<yweather:units temperature="F" distance="mi" pressure="in" speed="mph
+"/>
<yweather:wind chill="64" direction="0" speed="0" />
<yweather:atmosphere humidity="70" visibility="10" pressure="30.13" ri
+sing="0" />
<yweather:astronomy sunrise="5:32 am" sunset="8:21 pm"/>
<image>
<title>Yahoo! Weather</title>
<width>142</width>
<height>18</height>
<link>http://weather.yahoo.com</link>
<url>http://l.yimg.com/a/i/us/nws/th/main_142b.gif</url>
</image>
<item>
<title>Conditions for Chicago, IL at 11:51 pm CDT</title>
<geo:lat>41.84</geo:lat>
<geo:long>-87.68</geo:long>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Chicago__IL/*http:/
+/weather.yahoo.com/forecast/USIL0225_f.html</link>
<pubDate>Sun, 19 Jul 2009 11:51 pm CDT</pubDate>
<yweather:condition text="Partly Cloudy" code="29" temp="64" date="Sun
+, 19 Jul 2009 11:51 pm CDT" />
<description><![CDATA[
><img src="http://l.yimg.com/a/i/us/we/52/29.gif"/><br />
<b>Current Conditions:</b><br />
Partly Cloudy, 64 F<BR />
<BR /><b>Forecast:</b><BR />
Sun - Partly Cloudy. High: 71 Low: 54<br />
Mon - Sunny. High: 78 Low: 62<br />
<br />
<a href="http://us.rd.yahoo.com/dailynews/rss/weather/Chicago__IL/*htt
+p://weather.yahoo.com/forecast/USIL0225_f.html">Full Forecast at Yaho
+o! Weather</a><BR/><BR/>
(provided by <a href="http://www.weather.com" >The Weather Channel</a>
+)<br/>
]]></description>
<yweather:forecast day="Sun" date="19 Jul 2009" low="54" high="71" tex
+t="Partly Cloudy" code="29" />
<yweather:forecast day="Mon" date="20 Jul 2009" low="62" high="78" tex
+t="Sunny" code="32" />
<guid isPermaLink="false">USIL0225_2009_07_19_23_51_CDT</guid>
</item>
</channel>
</rss><!-- api2.weather.ac4.yahoo.com compressed/chunked Sun Jul 19 22
+:30:42 PDT 2009 -->
If am not missing anything here the possible reason for the error is that yahoo is not returning any data for zip=60642 and there is no code to handle this condition therefore "$nodeset->get_node($index);" returns a undef value.
I tried the same with "http://weather.yahooapis.com/forecastrss" and got the same results (no data for 60642), therefore I don't think changing URL will help. What you need is to handle the condition in the code.
|