• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what's wrong with this method?

#1
[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 .


Messages In This Thread
what's wrong with this method? - by El Forum - 06-19-2010, 06:50 PM
what's wrong with this method? - by El Forum - 06-20-2010, 02:21 PM
what's wrong with this method? - by El Forum - 06-20-2010, 11:13 PM
what's wrong with this method? - by El Forum - 06-21-2010, 10:34 AM
what's wrong with this method? - by El Forum - 06-21-2010, 02:30 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.