Retrieving and parsing an RSS feed from del.icio.us.
Magpie RSS makes life easy.
<?php // -*- fill-column: 80; tab-width: 4; c-basic-offset: 4 -*-
require_once 'lib/magpie/rss_fetch.inc';
require_once 'lib/magpie/rss_parse.inc';
define('NL', "\n");
/* would normally use */
//$url = 'http://del.icio.us/rss/tag/php';
//$rss =& fetch_rss($url);
/* but to use a local copy of the RSS file */
$file = 'del.icio.us.rss.tag.php.xml';
$rss_string = file_get_contents($file);
$rss =& new MagpieRSS($rss_string);
/* Print basic output to the console */
echo $rss->channel['title'] . NL;
foreach ($rss->items as $item) {
echo $item['title'] . NL;
}
?>
