1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Parsing RSS Feeds with PHP

Discussion in 'PHP' started by pradeep, Jun 2, 2007.

  1. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,646
    Likes Received:
    86
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:

    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



    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");
     
     
  2. jhbalaji

    jhbalaji New Member

    Joined:
    Jul 2, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    I hope simply we can use SimplePie their documentation teaches you a lot too :)
     
  3. shrikrishnatech

    shrikrishnatech New Member

    Joined:
    Nov 19, 2010
    Messages:
    42
    Likes Received:
    4
    Trophy Points:
    0
    Occupation:
    Wordpress theme, Wordpress Theming, WP Themes, Cor
    Home Page:
    thanks for the code but it is working with Working with multiple feeds?
     

Share This Page