Saturday, 18 October 2014

XMLparsing issue PHP



Im trying to parse the following XML :



`<item><title><![CDATA[Van Gaal: Keep the faith]]></title><description><![CDATA[Manchester United manager Louis van Gaal is in a bullish mood ahead of Monday's trip to face West Brom in front of the Sky Sports cameras.]]>
</description><link>http://ift.tt/11KFCrN;
<guid isPermaLink="false">11661_9520895</guid>
<pubDate>Fri, 17 Oct 2014 16:48:00 GMT</pubDate>
<category>News Story</category>
<enclosure type="image/jpg" url="http://ift.tt/11KFA36" length="123456" /></item>`


I am using the following code in my PHP script



$url = $xml->channel->attributes ()->items[$i]->enclosure->url;


But im not having much luck getting the url for the image. I have tried using the attribute() function, that didn't work.


Any suggestions would be gratefully appreciated .


Thanks


No comments:

Post a Comment