Can't Parse RSS XML with PHP -
i have rss trying parse url: http://weather.yahooapis.com/forecastrss?w=12797541
but when try parse using php doing this:
$yahoo_response = new simplexmlelement($yahoo_url , 0, true); echo $yahoo_response->rss->channel->item->title; echo $yahoo_response->rss->channel->item->description;
nothing gets outputed. know doing wrong here? need current forecast bit.
thanks, alex
the root element <rss>
, represented simplexmlelement
loaded $yahoo_response
.
echo $yahoo_response->getname(); // rss
you trying <rss><rss>
when should do:
echo $yahoo_response->channel->item->title; echo $yahoo_response->channel->item->description;
Comments
Post a Comment