Using RSS—Sample PHP Code

lastRSS

<?php
// include lastRSS library
include './lastRSS.php';
// create lastRSS object
$rss = new lastRSS;
// setup transparent cache
$rss->cache_dir = './cache';
$rss->cache_time = 3600; // one hour
// load RSS file and print item
$rs = $rss->get('https://www.infoplease.com/rss/birthday.rss')
if ($rs) { print <<<EOT
<b><a href="/rss/$rs[link]">$rs[title]</a></b><br>
EOT; $item = array_pop ($rs[items]); print <<<EOT <a href="/rss/$item[link]">$item[title]</a> ($item[description])
EOT;
}
?>

Installation:

  1. Download lastRSS.php from http://lastrss.webdot.cz/
  2. Save lastRSS.php to the same directory containing the page displaying the RSS feed
  3. Set cache directory (cache_dir) manually