Mega Code Archive

 
Categories / Php / Code Snippets
 

Reading RSS feeds with PEAR xml_rss package

<?php ini_set("include_path", '/home/path_to_include_folder/xmlrss/' . PATH_SEPARATOR . ini_get("include_path")); require_once 'RSS.php'; $rss_feed = 'http://www.php.net/news.rss'; $rss =& new XML_RSS($rss_feed); $rss->parse(); print "<ul>\n"; foreach($rss->getItems() as $item) { echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></li>\n"; } print "</ul>\n"; ?>