I'm trying to recover the images from a bbc rss feed to display on my site but for all my trying I can't seem to. I know I need to define the media namespace as its custom created but I can't see where I'm going wrong. Please help!
RSS
My PHP:
RSS
Code:
<channel>
<title>Earthquake felt across much of UK</title>
<description>The biggest earthquake in the UK for nearly 25 years is felt across large parts of England and Wales.</description>
<link>http://news.bbc.co.uk/go/rss/-/1/hi/england/7266136.stm</link>
<guid isPermaLink="false">http://news.bbc.co.uk/1/hi/england/7266136.stm</guid>
<pubDate>Wed, 27 Feb 2008 12:18:32 GMT</pubDate><category>England</category>
<media:thumbnail width="66" height="49" url="http://newsimg.bbc.co.uk/media/images/44453000/jpg/_44453498_seismogram66.jpg"/></item>
<item>
</channel>
My PHP:
PHP:
$url = 'http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml';
$rawFeed = file_get_contents($url);
$xml = new SimpleXmlElement($rawFeed);
foreach($xml->channel->item as $item)
{
$ns = $item->children('http://search.yahoo.com/mrss/');
echo $ns->thumbnail;
}