|
|||
|
Hello,
I would like to process a yahoo weather feed with Zend Framework : Yahoo! Weather - Paris, FR Retreive the feed is not a problem. However, i can't get interestings elements like the markup content for :<yweather:... /> Here's the Php code and the xml file (RSS 2.0 format) produced by yahoo : PHP Code:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <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 - Paris, FR</title> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Paris__FR/*http://weather.yahoo.com/forecast/FRXX0076_c.html</link> <description>Yahoo! Weather for Paris, FR</description> <language>en-us</language> <lastBuildDate>Mon, 28 Jan 2008 11:00 pm CET</lastBuildDate> <ttl>60</ttl> <yweather:location city="Paris" region="" country="FR"/> <yweather:units temperature="C" distance="km" pressure="mb" speed="kph"/> <yweather:wind chill="-2" direction="150" speed="10"/> <yweather:atmosphere humidity="93" visibility="501" pressure="0" rising="0"/> <yweather:astronomy sunrise="8:27 am" sunset="5:40 pm"/> <image> <title>Yahoo! Weather</title> <width>142</width> <height>18</height> <link>http://weather.yahoo.com/</link> <url>http://l.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif</url> </image> <item> <title>Conditions for Paris, FR at 11:00 pm CET</title> <geo:lat>48.86</geo:lat> <geo:long>2.35</geo:long> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Paris__FR/*http://weather.yahoo.com/forecast/FRXX0076_c.html</link> <pubDate>Mon, 28 Jan 2008 11:00 pm CET</pubDate> <yweather:condition text="Mostly Cloudy" code="27" temp="1" date="Mon, 28 Jan 2008 11:00 pm CET"/> <description><![CDATA[ <img src="http://l.yimg.com/us.yimg.com/i/us/we/52/27.gif" /><br /> <b>Current Conditions:</b><br /> Mostly Cloudy, 1 C<BR /><BR /> <b>Forecast:</b><BR /> Mon - Mostly Cloudy. High: 8 Low: 0<br /> Tue - Cloudy. High: 6 Low: 1<br /> <br /> <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Paris__FR/*http://weather.yahoo.com/forecast/FRXX0076_c.html">Full Forecast at Yahoo! Weather</a><BR/> (provided by The Weather Channel)<br/> ]]></description> <yweather:forecast day="Mon" date="28 Jan 2008" low="0" high="8" text="Mostly Cloudy" code="27"/> <yweather:forecast day="Tue" date="29 Jan 2008" low="1" high="6" text="Cloudy" code="26"/> <guid isPermaLink="false">FRXX0076_2008_01_28_23_0_CET</guid> </item> </channel> </rss> <!-- p6.weather.re3.yahoo.com compressed/chunked Mon Jan 28 14:23:55 PST 2008 --> ![]() Thanks. Eric Pommereau |
|
|||
|
Two guys were walking through the jungle. All of a sudden, a tiger appears from a distance, running towards them. One of the guys takes out a pair of "Nikes" from his bag and starts to put them on. The other guy with a surprised look and exclaims, "Do you think you will run faster than the tiger with those?"His friend replies: "I don't have to out run it, I just have to run faster than you."----------------------------------Do you look for free wow gold? Welcome to our WoW gold website:1.WoW gold,2.WoW gold,
__________________
Free WoW gold.. |
|
|||
|
What's more, I can't get rss/channel/item/description neither. When I code
PHP Code:
I have used MagpieRSS, a RSS parser, it can get "<description><![CDATA[..." |
|
|||
|
Zend_Feed::registerNamespace('yweather','http://xml.weather.yahoo.com/ns/rss/1.0');
$feed = Zend_Feed::import('http://xml.weather.yahoo.com/forecastrss?p=EIXX0014&u=c'); $condition = $feed->current()->{'yweather:condition'}; $text = $condition->getDOM()->getAttribute('text'); var_dump($text); |
![]() |
| Thread Tools | |
| Display Modes | |
|
|