Looks like DOMDocument is a lot more effective (and powerful). I had some luck with this script:
<?php
$pre="http://weather.yahooapis.com/forecastrss?w=2255054&u=c";
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, $pre);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 50);
$html = curl_exec ($curl);
curl_close ($curl);
//echo "<pre>";
//echo htmlspecialchars($html);
//echo "</pre>";
$doc = new DOMDocument();
if (!$doc->loadXML($html)) {
throw new Exception("xml load failed.");
}
//echo htmlspecialchars($doc->saveXML());
//die();
// <yweather:forecast day="Wed" date="4 Dec 2013" low="0" high="3" text="Cloudy" code="26"/>
$attribute_names = array(
"day",
"date",
"low",
"high",
"text",
"code"
);
$forecasts = $doc->getElementsByTagNameNS("http://xml.weather.yahoo.com/ns/rss/1.0", "forecast");
foreach ($forecasts as $fc) {
foreach($attribute_names as $name) {
echo " " . $name . "=" . $fc->getAttribute($name) . "<br>";
}
}
?>