MagpieRSS: RSS for PHP


MagpieRSS provides an XML-based (expat) RSS parser in PHP.

MagpieRSS is compatible with RSS 0.9 through RSS 1.0. Also parses RSS 1.0's modules, RSS 2.0, and Atom. (with a few exceptions)

News!

<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>

Is parsed, and pushed on the $rss->items array as:

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'
	)
);

image and textinput

$rss->image and $rss-textinput are associative arrays including name-value pairs for anything found between the respective parent tags.

Usage Examples:

A very simple example would be:
require_once 'rss_fetch.inc';

$url = 'http://magpie.sf.net/samples/imc.1-0.rdf';
$rss = fetch_rss($url);

echo "Site: ", $rss->channel['title'], "<br>
";
foreach ($rss->items as $item ) {
	$title = $item[title];
	$url   = $item[link];
	echo "<a href=$url>$title</a></li><br>
";
}
More soon....in the meantime you can check out a cool tool built with MagpieRSS, version 0.1.

Todos

RSS Parser

RSS Cache

Fetch RSS

Misc

Getting Help With Magpie

RSS Resources

License and Contact Info

Magpie is distributed under the GPL license...

Questions, and suggestions, [email protected]

coded by: kellan (at) protest.net, feedback is always appreciated.

Development sponsored in part by AOE media, a TYPO3 & Open Source provider from Germany.

SourceForge.net Logo