weatherbug API を使用しようとしていますが、手続きのかなり早い段階で行き詰まっているようです。
私が試した[非常に単純な]コード:
function weather_widget($apikey, $zipcode) {
$url = "http://$apikey.api.wxbug.net/getLiveWeatherRSS.aspx?ACode=$apikey&zipcode=$zipcode&unittype=0&outputtype=1";
$contents = file_get_contents($url);
$doc = new DOMDocument();
$doc->loadXML($contents);
return $doc->getElementsByTagName('aws:weather');
}
var_dump(weather_widget($key, $code));
これにより、次のものが生成されました。
object(DOMNodeList)#2 (0) { }
: を含む at tagname では XML DOM は機能しませんか?