...

View Full Version : Rss



alex57
11-04-2006, 01:55 PM
Hello,

Does anyone know if it is possible to get data from an rss feed and "put" it into a MySQL database??

Thanks

vinyl-junkie
11-04-2006, 06:38 PM
I have RSS feeds on my site that read a MySQL database and display the feeds, so I don't know why you couldn't do the reserve and store the data rather than read it.

Are you talking about scraping feed data off another site or what? You need to supply some details as to where the feed data will be coming from.

GJay
11-04-2006, 08:19 PM
Magpie RSS allows you to provide a URL, and be returned an object representing the RSS feed.
You can iterate over the result, and insert into the database, something like:


$rss = fetch_rss('http://www.google.com/news.rss');
foreach($rss->items as $item) {
$query='INSERT INTO news (headline,content,date) VALUES ('
.mysql_real_escape_string($item['title']).','
.mysql_real_escape_string($item['body']).','
.mysql_real_escape_string($item['pubdate'])
.')';
mysql_query($query) or die($query.mysql_error());
}


Magpie instructions:
http://magpierss.sourceforge.net/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum