I am trying to get recent posts from my blog's rss and print them through php, All I have done has worked fine but I am unable to get image thumbnail from the XML file. It is stored in an attribute.
My xml output is:
<item><title>Stackoverflow inspired movies list</title><link>http://www.example.com/2015/03/movies-list.html</link><author>(Ididntknewit)</author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://the.url.com/image.png' height='72' width='72'/><thr:total>0</thr:total></item>
My PHP Code:
<?php
header('Content-Type: text/html');
$rss =simplexml_load_file($requestURL);
?>
<?php
echo '<ul>';
foreach($rss->channel->item as $post){
echo '<li>';
$max = $post->media:thumbnail['url'];
echo $max;
echo '<a href="'.$post->link.'">'.$post->title.'</a>';
echo '</li>';
}
echo '</ul>';
?>
How can I get the thumbnail URL.