Error/Warning parsing RSS XML :( -
i did
<blink> $xml = file_get_contents(http://weather.yahooapis.com/forecastrss?w=12797541); $yahoo_response = new simplexmlelement($xml , 0, true); </blink>
and got xml parse warning this:
php warning: simplexmlelement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: i/o warning : failed load external entity "<?xml version="1.0"
.....
with important part of message being this:
i/o warning : failed load external entity
and not parse line:
echo (string) $yahoo_response->rss->channel->item->title;
does know how fix or around it?
thanks, alex
3rd argument of simplexmlelement()
specifies if $data
url. should either
$xml = file_get_contents('http://weather.yahooapis.com/forecastrss?w=12797541'); $yahoo_response = new simplexmlelement($xml , 0, false); // false, not true
or
$xml = 'http://weather.yahooapis.com/forecastrss?w=12797541'; // url, not contents $yahoo_response = new simplexmlelement($xml , 0, true);
Comments
Post a Comment