After a quick response from the mailing list and references to the PHP online manual I came up with the solution.
Thanks to Pádraic Brady for the assistance.
Zend_Feed::registerNamespace('yweather','http://xml.weather.yahoo.com/ns/rss/1.0');
Zend_Feed::registerNamespace('geo','http://www.w3.org/2003/01/geo/wgs84_pos#');
$feed = Zend_Feed::import("http://weather.yahooapis.com/forecastrss?p=38105");
// Conditional Codes: http://developer.yahoo.com/weather/#codes
$condition = $feed->current()->{'yweather:condition'};
$text = $condition->getDOM()->getAttribute('text');
print "Text {$text}
";
$astronomy = $feed->{'yweather:astronomy'};
$text = $astronomy->getDOM()->getAttribute('sunrise');
print "Sunrise Attribute {$text}
";
$lat = $feed->current()->{'geo:lat'};
$text = $lat->getDOM()->nodeValue;
print "Latitude {$text}
";
No comments:
Post a Comment