Parsing RSS Feeds with PHP

pradeep's Avatar author of Parsing RSS Feeds with PHP
This is an article on Parsing RSS Feeds with PHP in PHP.

Introduction



RSS is a family of web feed formats used to publish frequently updated content such as blog entries, news headlines or podcasts. An RSS document, which is called a "feed," "web feed," or "channel," contains either a summary of content from an associated web site or the full text. RSS makes it possible for people to keep up with their favorite web sites in an automated manner that's easier than checking them manually.

In this article we'll see how to parse RSS Feeds using the PEAR package XML_RSS.

Installing the PEAR package



Issue this command in the command line,
Code:
pear install --alldeps XML_RSS

Sample Code



Code: PHP
require_once("XML/RSS.php");
 
 $feed_uri = "http://www.go4expert.com/external.php?type=rss&forumids=17";
 
 $rss =& new XML_RSS($feed_uri);
 $rss->parse();
 
 print("<h1>New PHP articles from <a href=\"http://www.go4expert.com\">Go4Expert</a></h1>\n");
 
 print("<ul>\n");
 
 foreach ($rss->getItems() as $item)
 {
    printf("<li><a href=\"%s\">%s</a></li>\n",$item['link'],$item['title']);
 }
 
 print("</ul>\n");
0
jhbalaji's Avatar, Join Date: Jul 2010
Newbie Member
I hope simply we can use SimplePie their documentation teaches you a lot too
0
shrikrishnatech's Avatar, Join Date: Nov 2010
Go4Expert Member
thanks for the code but it is working with Working with multiple feeds?