I'm trying to build a custom RSS feed displayer, which works perfectly apart from the image. I can see that the RSS feed displays the image like so:
<description><![CDATA[<img width="150" height="150" src="/blog/wp-content/uploads/2015/10/image.jpg" class="attachment-thumbnail wp-post-image" alt="" style="display: block; margin-bottom: 5px; clear:both;" /><p></p>
]]></description>
and this is the code that im using to get the RSS feed, without the image part working. Any help would be great!
$rss = new DOMDocument();
$rss->load('/blog/feed/');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'image' => $node->getElementsByTagName('image')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 4;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
$image = $feed[$x]['image'];
?>
<div class="row">
<div class="col-md-4 col-sm-12 col-xs-12">
<img src="/img/<?php echo $image ?>.jpg" class="blogImages" alt="<?php echo $title ?>" title="<?php echo $title ?>">
</div>