Jump to content

Archive RSS Feeds to webpage


Cyberdave

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.