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 Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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! Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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) Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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.