It seems like the external URL was not read and so the value was not retrieved. May I know why my code does not work?
function GetFeed($url){
$feed = simplexml_load_file($url);
$feed_array = array();
foreach($feed->channel->item as $story){
$story_array = array (
'title' => $story->title,
'description' => $story->description
);
array_push($feed_array, $story_array);
}
return $feed_array;
}
$url = 'http://www.channelnewsasia.com/rss/latest_cna_sg_rss.xml';
$news = GetFeed($url);
echo $news[0]['title'];