Home | Mirror | Search

5. XML_RSS

http://pear.php.net/package/XML_RSS

$ sudo apt-get install php-xml-rss
		

例 20.1. RSS.php

			
 <?php
require_once "XML/RSS.php";

$rss = new XML_RSS("http://rss.slashdot.org/Slashdot/slashdot");
$rss->parse();

echo "<h1>Headlines from <a href=\"http://slashdot.org\">Slashdot</a></h1>\n";
echo "<ul>\n";

foreach ($rss->getItems() as $item) {
    echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></li>\n";
}

echo "</ul>\n";
?>
			
			

comments powered by Disqus