[eluser]7amza[/eluser]
Hello ,
what's wrong with this method :
Code:
/*database :
table : rss
id : int(auto)
link : varchar(255)
title:varchar(255)
table:news
id:int(auto)
title:varchar(255)
date:varchar(50)
link:varchar(255) // the link of the details in the website
content:text // the description of the rss
cat:INT // the category id of the entry
*/
function index(){
set_time_limit(2160000000);
//get the rss links and them category like : http://google.com/rss.xml , http://yahoo.com/rss.xml , http://msn.com/rss.xml
$rss = $this->Mrss->get();
//extract the array
foreach($rss->result() as $rss){
$cat = $rss->cat;
$url = $rss->url;
$this->load->library('RSSParser', array('url' => $url, 'life' => 2));
//a loop to get the rss from each link
$datas = $this->rssparser->getFeed(40);
foreach ($datas as $item) {
$word = array("\\","/","\"","'");
$data['title'] = htmlspecialchars(str_replace($word,"-",$item['title'])) ;
$data['content'] = $item['description'] ;
$data['link'] = $item['link'] ;
$data['cat'] = $cat;
//check if the entry was already added and then save it to the database
if($this->Mnew->getbylink($data['link'])==FALSE){
$this->Mnew->add($data);
}
}
}
}
the problem that when i add 5 or 6 link the method don't grab all the feed just one or two from one category and it ignore all other category .
i use rssparser .