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?
Magpie is a reasonable RSS parser for PHP. Easy to use:
require('rss_fetch.inc'); $rss = fetch_rss($url);
An item like this for example:
<item rdf:about="http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257"> <title>Weekly Peace Vigil</title> <link>http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257</link> <description>Wear a white ribbon</description> <dc:subject>Peace</dc:subject> <ev:startdate>2002-06-01T11:00:00</ev:startdate> <ev:location>Northampton, MA</ev:location> <ev:enddate>2002-06-01T12:00:00</ev:enddate> <ev:type>Protest</ev:type> </item>
Would be turned into an array like this:
array( title => 'Weekly Peace Vigil', link => 'http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257', 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!