The code below gets rss feeds from yahoo and it works but I have a little problem, when I rub the code, it returns the feeds but it also gives me an error like -
Undefined offset: 1 in /Applications/MAMP/htdocs/feedbackFtms/rss.php on line 8
line 8 is -
$foundImg = $findImg[1];
<div class="feed">
<link rel="stylesheet" href="css/profilepage.css">
<?php
function getImageFromContext($context){
$findImg = explode('<img src="',$context);
$foundImg = $findImg[1];
$findExt = explode('.jpg',$foundImg);
$getIMG = $findExt[0].'.jpg';
return $getIMG;
}
function getFeed($url){
$x = simplexml_load_file($url);
echo "<ul>";
foreach($x->channel->item as $entry) {
echo "<li><img src='".getImageFromContext($entry->description)."' /><a href='{$entry->link}' title='{$entry->title}'>{$entry->title}</a></li><br>";
}
echo "</ul>";
}
getFeed("http://news.yahoo.com/rss/entertainment");
?>
</div>