Php – the best way to get RSS Feeds into a MySQL Database


I am trying to take several RSS feeds, and put the content of them into a MySQL Database using PHP. After I store this content, I will display on my own page, and also combine the content into one single RSS Feed. (Probably after filtering)

I haven't dealt with RSS Feeds before, so I am wondering the best Framework/Method of doing this is. I have read about DOM based parsing, but have heard that it takes a lot of memory, any suggestions?

Best Solution

Magpie is a reasonable RSS parser for PHP. Easy to use:

$rss = fetch_rss($url);

An item like this for example:

<item rdf:about="">
<title>Weekly Peace Vigil</title>
<description>Wear a white ribbon</description>
<ev:location>Northampton, MA</ev:location>

Would be turned into an array like this:

    title => 'Weekly Peace Vigil',
    link => '',
    description => 'Wear a white ribbon',
    dc => array (
            subject => 'Peace'
    ev => array (
        startdate => '2002-06-01T11:00:00',
        enddate => '2002-06-01T12:00:00',
        type => 'Protest',
        location => 'Northampton, MA'

Then you can just pick out the bits you want to save in the DB and away you go!