RSS2MySQL

RSS2MYSQL - RSS Randomizer + Feed Compiler

RSS2MySQL is a very simple script that takes multiple rss feeds(or just one), and stores their items nto a mysql database table.

With this "pool", you can call items randomly onto your webpage with every page load. Use css stylizng the customize the output.

Randomizing the rss helps you to avoid the duplicate content issues by creating a unique content-thumb-print with every page load.

Declaring multiple rss feeds mixes content from multiple sources, further randomizing your output. You can still use this script to parse and randomize single feeds as well.

The Files

1. "rss2mysql/cron_config.php"
2. "rss2mysql/temp.txt"


cron_config.php is the main config file where you declare your database information and rss feed information. It is the heart of the script. Once the configurations have been edited and saved you will go into your hosting provider control panel and set a cron job to run daily on this file. This cron job will refresh your rss feed items, keeping your syndicated feeds up-to-date.

temp.txt is just what it sounds like-- a temporary file. It is used to hold temporary information about your rss feed items while the script cron_config.php runs.

The only comnplicated parts of running and installing this program will be creating a table in your database, and calling items from the database into the desired places of your website. I will include directions on how to do both of these within the zip file.





RSS2MySQL in action...
  • http://feeds.paidcontent.org/pcorg/
  • http://www.huffingtonpost.com/feeds/verticals/business/index.xml
  • http://spearthrowers.blogspot.com/rss.xml
  • http://www.nytimes.com/services/xml/rss/nyt/GlobalBusiness.xml


  • A new book, "$20 Per Gallon," predicts what daily life could become as demand for oil escalates. ...

    ...

    Mary Poppins vs. Dr. Strange: The Cloak of the Vishanti vs. A Spoonful of Sugar! The Faltine dimension vs. the racetrack full of penguins! "Abracadabra" vs. "Supercalifragilisticexpialadocious†...

    Private networks are complaining about the state aid given to public broadcasters, while the matter of their core businesss move to the Internet is at issue. ...

    The landslide victory of Dr. Yukio Hatoyama's Democratic Party of Japan (DPJ) has given a once-in-a-lifetime opportunity to effect change in the way Japan does business. ...

    The president is now renewing his courtship of the labor movement, whose members worked as foot soldiers in his campaign. ...

    ...

    A dispute over claims that Europe and the United States subsidized aircraft makers became less important because planes are now built in several countries. ...

    More than two-thirds of all foreign armament deals last year were made with U.S. suppliers, a study found. ...

    American International Group said Saturday it reached a deal to sell a portion of the unit to a Hong Kong-based investment firm. ...


    FAQ



    >> Hi.
    >>
    >> I am looking for a script that will take an RSS feed, specifically the
    >> one provided by Google News on its Business page, and automatically
    >> dump all articles to a MySQL database.
    >>
    >> I have a few questions about your script:

    >>
    >> 1) Does it store the results in MySQL?
    >> 2) How does it manage duplicates?
    >>
    >> I am actually not concerned with the display. I just want something that will grab all the rss feed as it updates and not duplicate....


    RSS2MYSQL will take all the news items + descriptions available on the feed and place them into a database table. They are randomized by the way we call them from the database table-- we use and ORDER BY rand() statement in the database query. Then as when we cycle through the query results they are listed in a random order. I attached an example of how to call the items once they have been stored.

    As for the duplicates: It will do that. When the script runs, it deletes all the items previously in the table and then repopulates the table with whatever is currently on the feeds listed within the script config. You can set up the cron to run the script as often as you would like.




    >> Can RSS2MYSQL be used in a serverside include script?

    Yes it can. I attached an example excerpt of how I call the randomized feed onto my home-page (annualreportresources.com), it should work just like any other php function.

    <table>
    <tr>
    <td width=100%><br>
    <h3>Whats going on in the economic world?</h3><br>
    <?php

    //set number of items you would like to display
    $limit = rand(7,10); //random number between 7 and 10
    //or you could simply do this
    //$limit = 7;

    //call items from database
    $query = "SELECT DISTINCT * FROM rssitems ORDER BY rand() LIMIT $limit"; $result = mysql_query($query);
    if (!$result){echo "bad query. check your table name."; exit;}


    // loop through and print each item
    while ($array = mysql_fetch_array($result))
    {
        $title = $array['title'];
        title = htmlspecialchars_decode($title);
        $description = $array['description'];
        $description = htmlspecialchars_decode($description);
        $link = $array['link'];
        //style your articles
        echo "<div style='font-weight:600;font-size:13px;text-decoration:underline;'><a href='$link' style='color:#191970;' target=new>$title</a></div>";
        echo "<div>";
        echo "$description ...";
        echo "</div><br>";
    }
    ?>
    </td>
    </tr>
    </table>




    >> How do I set up RSS2MYSQL's cron job?

    I always use my host's control panel to set up my cronjob. Setting up a cron is like declaring a special path to the script in the area that handles all cron jobs, and then declaring how often you would like to run the script indicated in the pathway. Within the script there are some instructions on what a cron command should look like, and how to go about setting it up. If you get flustered with the newness of cron jobs then just shoot your host an email or check their help files. All good hosts have documentation on how to go about this.







    TWEETSTREAM - STREAM TWITTER TWEETS LIVE   |   REMOVE DUPLICATE EMAILS - BULK LIST MNGT   |   DIGITAL GOOGLE CHECKOUT - SELL DIGITAL PRODUCTS   |   Atwell Publishing 2009