bef1rst Posted July 16, 2006 Share Posted July 16, 2006 Hello,I would like to use a loop in order to use different feed rss in this script but i don't know where i must put it. [quote]<?require('rss_fetch.inc');include('../config.php');require(mnminclude.'link.php');$rss_feeds=array( array( 'url'=>"http://feeds.feedburner.com/rss2.xml", 'category'=>15, 'author'=>15, 'tags'=>"tags1" ),);echo "<ul>\n";foreach ($rss_feeds as $feed ) {$rss = fetch_rss($feed['url']);echo "<li>Site: ", $rss->channel['title'], "<br>\n";foreach ($rss->items as $item ){if ($i <= 10) { $item['author']=$feed['author']; $item['category']=$feed['category']; $title = $item[title]; $desc= $item[description]; echo "<ul>"; echo "<li>Processing <a href=$url>$title</a></li>\n"; rss_store($item); echo "<li>Finished Processing <a href=$url>$title</a></li><br><br/>\n\n"; echo "</ul>"; } $i++;}echo "</li>";}echo "</ul>";function rss_store($item) { $linkres=new Link; $edit = false; $linkres->get(trim($item['link'])); if(!$linkres->valid) { rss_error($item['link']); return; } if($linkres->duplicates($item['link']) > 0) { rss_error($item['url']); return; } $linkres->status='discard'; $linkres->author=$item['author']; $linkres->title=$item['title']; $linkres->content=$item['description']; $linkres->id=0; $linkres->category=$item['category']; $linkres->randkey=rand(10000,10000000); $linkres->read(); $linkres->status='queued'; $linkres->store(); return;}function rss_error($url){ echo "Skipped $url <br/>\n";}?>[/quote]This script works and i just would like to put different feed. I would like to create a table in my mysql database in order to write the different feed. I have already do this job.Thanks for your answers. Quote Link to comment https://forums.phpfreaks.com/topic/14753-where-write-my-loop-in-this-php-script/ Share on other sites More sharing options...
PC Nerd Posted July 16, 2006 Share Posted July 16, 2006 i didnt read all the script, but the following might work$feed = "INPUT FROM FEILD"include('inc_files/'.$feed/"'");simply save your different feeds as seperate inc files.you could also create an array, which could check the input, to that sent data could be simply 1, 2,3 ,4 5, 6 7 ,8 8 etc.good luck Quote Link to comment https://forums.phpfreaks.com/topic/14753-where-write-my-loop-in-this-php-script/#findComment-58938 Share on other sites More sharing options...
bef1rst Posted July 16, 2006 Author Share Posted July 16, 2006 Thanks for your answer. I will test as soon as possible.I have another idea: I made a request in MYSQL who take the URL of the feed in a table of a database. It's better for the organisation of the feed because i can create an administrator acces etc.I thnik that my request could be at the beginning of this part of the script:[code]$query = "SELECT url FROM feed"; $result = mysql_query($query);while ($val = mysql_fetch_array($result)) { $rss_feeds=array( array( 'url'=>"$url", 'category'=>15, 'author'=>15, 'tags'=>"tags1" ),);} ?>[/code]What do you think of that ? Thanks for your answers. Quote Link to comment https://forums.phpfreaks.com/topic/14753-where-write-my-loop-in-this-php-script/#findComment-59009 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.