caching/parsing RSS with PEAR XML_RSS

Source code


<?php include('./.config.php');
require(
'Cache/Lite/Output.php');
$id 'slashotdot.rss';

$options = array(
    
'cacheDir' => './cache/',
    
'lifeTime' => 3600    // 1 hour
);
$cache = new Cache_Lite_Output($options);
10 
11 if (
strcasecmp($_SERVER['QUERY_STRING'],'remove')==0) {
12     
$cache->remove($id)    ;
13     exit(
"cache purged");
14 }
15 
16 if (!(
$cache->start($id))) {
17     
18     require_once 
"XML/RSS.php";
19     
$rss =& new XML_RSS("http://slashdot.org/slashdot.rss");
20     
$rss->parse();
21     echo 
"<h1>Headlines from <a href=\"http://slashdot.org\">Slashdot</a></h1>\n";
22     echo 
"<ul>\n";
23     foreach (
$rss->getItems() as $item) {
24         echo 
'<li><a href="'.$item['link'].'">'.$item['title']."</a><br/>".$item['description']."</li>\n";
25     }
26     echo 
"</ul>\n";
27     
$cache->end(); // the buffered output is now stored into a cache file
28     
echo "<p>......used fresh data.........</p> ";
29 
30 } else {
31     
32     echo 
"<p>.... and I got it from the cache, how cool is that? (-:</p>" ;
33 }
34 include(
'./.footer.php')?>

Output


Warning: require(Cache/Lite/Output.php) [function.require]: failed to open stream: No such file or directory in /home/davidmintz/www/davidmintz.org/php_course/examples/10/pear_rss.cached.php5 on line 2

Fatal error: require() [function.require]: Failed opening required 'Cache/Lite/Output.php' (include_path='/usr/home/dmintz/inc/pear:.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/davidmintz/www/davidmintz.org/php_course/examples/10/pear_rss.cached.php5 on line 2