Fatal error: Call to undefined method SimpleXMLElement::attribute() in D:\Program Files\wamp\www\New folder\ndtv_news.php on line 13
How to define method .....
<?php
//fetches articles from NDTV news RSS feed
function fetch_news(){
$data = file_get_contents('http://feeds.feedburner.com/News-TN');
$data = simplexml_load_string($data);
$articles = array();
foreach ($data->channel->item as $item){
$media = $item->children('http://search.yahoo.com/mrss');
$image = array();
foreach($media->attribute() as $key => $value)
{
$image[$key] = (string)$value;
}
$articles[] = array('title'=>(string)$item->title,
'description'=>(string)$item->description,
'link'=>(string)$item->link,
'date'=>(string)$item->pubDate,
'image'=>'$image');
}
return $articles;
}
?>
Fatal error: Call to undefined method SimpleXMLElement::attr
Moderator: General Moderators
Re: Fatal error: Call to undefined method SimpleXMLElement::
Learn to use the PHP Code tags: paste your code into the textbox, select it, and click the PHP Code button.
Re: Fatal error: Call to undefined method SimpleXMLElement::
Can you give me an example.... 
Re: Fatal error: Call to undefined method SimpleXMLElement::
Check your other threads? I know a couple of us moderators have edited them for you. Or follow the three steps I posted.