Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/articles/php-tutorials/)
-   -   Parsing RSS Feeds with PHP (http://www.go4expert.com/articles/parsing-rss-feeds-php-t4522/)

pradeep 2Jun2007 12:42

Parsing RSS Feeds with 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");


jhbalaji 2Jul2010 11:05

Re: Parsing RSS Feeds with PHP
 
I hope simply we can use SimplePie their documentation teaches you a lot too :)

shrikrishnatech 19Nov2010 11:40

Re: Parsing RSS Feeds with PHP
 
thanks for the code but it is working with Working with multiple feeds?


All times are GMT +5.5. The time now is 21:10.