rss - When parsing multiple feeds with SimplePie in PHP, the $feed variable always holds the first feed, even though the URL has changed -


i want grab data website each page has own feed. therefore intend grab feeds sequentially, so:

$maxpages = 5;  ($i = 1; $i <= $maxpages; $i++) {     // create new instance of simplepie object     $feed = new simplepie();     $feed->set_feed_url('http://www.targetpage.org/forum?page=' . $i . '&foo=true');     $feed->enable_cache(false);     $feed->init();      foreach($feed->get_items() $item)     {         $md5 = md5($item->get_id());         $title = $item->get_title();         $href = $item->get_link();         $content = $con->real_escape_string($item->get_content());          //insert gathered data database         $query = "insert feed_items (md5, title, content, url) values ('$md5', '$title', '$content', '$href')";         mysqli_query($con, $query);     }    } 

so while every pass through 'for' loop url changes, stuff simplepie returns same. trying destroy $feed in end didn't help. fresh feed every time?


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -