Cyberdave Posted January 18, 2010 Share Posted January 18, 2010 I am working on a website for a club and I'm using rssinclude.com to add the clubs Facebook RSS feed to the news page. I am wondering if there is a way of archiving each feed to a 'news archive' page once it drops outside the 5 latest status updates? Thanks Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/ Share on other sites More sharing options...
jtgraphic Posted January 18, 2010 Share Posted January 18, 2010 I would read each line of the RSS feed out to a MySQL table. You could match the post ID's to a post ID field in the table. You could also do a match for content to check for duplicates. If you need some code, just let me know Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997194 Share on other sites More sharing options...
Cyberdave Posted January 18, 2010 Author Share Posted January 18, 2010 I would read each line of the RSS feed out to a MySQL table. You could match the post ID's to a post ID field in the table. You could also do a match for content to check for duplicates. If you need some code, just let me know I'm lost. I'm gonna PM you. Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997399 Share on other sites More sharing options...
jtgraphic Posted January 18, 2010 Share Posted January 18, 2010 Don't worry about a PM. I'll throw some code together and pop it up. We might as well make it public so everyone can see! Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997406 Share on other sites More sharing options...
Cyberdave Posted January 18, 2010 Author Share Posted January 18, 2010 Don't worry about a PM. I'll throw some code together and pop it up. We might as well make it public so everyone can see! Cool. Thank you very much. Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997412 Share on other sites More sharing options...
jtgraphic Posted January 18, 2010 Share Posted January 18, 2010 Do you have access to a MySQL database? Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997416 Share on other sites More sharing options...
Cyberdave Posted January 18, 2010 Author Share Posted January 18, 2010 Do you have access to a MySQL database? Well, initially I will be testing this on my own website, so yes. Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997418 Share on other sites More sharing options...
jtgraphic Posted January 18, 2010 Share Posted January 18, 2010 I picked up a packaged open source RSS reader here (I also picked up a bunch of their code, so it could probably be more efficient): http://www.ibm.com/developerworks/library/x-phprss/ I also use this function (db_query()): http://www.jtgraphic.net/2009/11/tidbit-tuesday-php-simple-mysql-database-query-function/ and this function (db_array_insert()): http://www.jtgraphic.net/2009/11/tidbit-tuesday-php-simple-mysql-database-insert-function/ First you'll need to set up a MySQL database with columns that match the tags in the RSS feed: link, title, description, etc. <?php require_once("RSS.php"); // These are the files referenced above. require_once("db_array_insert.php"); // These are the files referenced above. $rss =& new XML_RSS("http://www.tracypeterson.com/RSS/RSS.php"); $rss->parse(); $rss_array = array(); $cfg_array = array( "db_loc" => 'www.databaselocation.com', "db_user" => 'some user', "db_pass" => 'some password', "db_name" => 'database_name_here' ); foreach ($rss->getItems() as $item) { $insert_array = $item; db_array_insert($cfg_array, "some_table", $insert_array) } ?> Disclaimer: I haven't tested this, so there might be a syntax error or two, but the concept is correct (I think) Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997566 Share on other sites More sharing options...
Cyberdave Posted January 18, 2010 Author Share Posted January 18, 2010 Oh... I see. I think I may be out of my depth. I'm gonna give it a go anyway and report back if I get stuck along the way. Thanks so much for your help. Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997654 Share on other sites More sharing options...
jtgraphic Posted January 18, 2010 Share Posted January 18, 2010 No problem I look forward to hearing back from you. Link to comment https://forums.phpfreaks.com/topic/188874-archive-rss-feeds-to-webpage/#findComment-997656 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.