i have a little problem.I have the following code on my site to post some news from a rss file:
<?php$rss = new DOMDocument();$rss->load('http://rt.com/rss/');$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,'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, ); array_push($feed, $item);}$limit = 3;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'])); echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />'; echo '<small><em>Posted on '.$date.'</em></small></p>'; echo '<p>'.$description.'</p>';}?>
I want also to get the image link from the rss file that looks like:
enclosure url="IMG URL" length="" type=""
but i can't get it to work, i tried some examples found here, my php knowledge it's not so good.Any ideeas how to do it?
Thank you!