Change this :
//Assign the channel data
$this->channel_data['title'] = $xml->channel->title;
$this->channel_data['description'] = $xml->channel->description;
//Build the item array
foreach ($xml->channel->item as $item)
{
$data = array();
$data['title'] = $item->title;
$data['description'] = $item->description;
$data['pubDate'] = $item->pubDate;
$data['link'] = $item->link;
$this->data[] = $data;
}
Into this :
if($xml->channel){
//Assign the channel data
$this->channel_data['title'] = $xml->channel->title;
$this->channel_data['description'] = $xml->channel->description;
//Build the item array
foreach ($xml->channel->item as $item)
{
$data = array();
$data['title'] = $item->title;
$data['description'] = $item->description;
$data['pubDate'] = $item->pubDate;
$data['link'] = $item->link;
$this->data[] = $data;
}
}else{
//Assign the channel data
$this->channel_data['title'] = $xml->title;
$this->channel_data['description'] = $xml->subtitle;
//Build the item array
foreach ($xml->entry as $item)
{
$data = array();
$data['title'] = $item->title;
$data['description'] = $item->content;
$data['pubDate'] = $item->published;
$data['link'] = $item->link;
$this->data[] = $data;
}
}
If you get an error because some blogs using different “kind” of RSS xml format (i don’t know what is it).
Maybe you can add this to the lib.