Jump to content

Archive RSS Feeds to webpage


Cyberdave

Recommended Posts

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 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. :confused: I'm gonna PM you.

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)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.