php basics

Friday, July 07, 2006

Magpie & RSS

Real Simple Syndication

  • RSS is an xml-based format for sharing and distributing web content, such as news headlines.

  • Using an RSS reader, you can view data feeds from various new sources, such as CNN.com, including headlines, summaries, and links to full stories.

  • There is a good PHP RSS reader called Magpie that we can use to put the latest new from various sites on our pages.
  • Started in 1996; mostly developed in 1999

  • Example: http://edition.cnn.com/services/rss/
  • RSS solves a number of problems that both web developers and web users have faced for years.

Magpie, in the Author's Words


  • I wrote magpieRSS out of a frustration with the limitations of existing solutions. In particular many of the existing PHP solutions seemed to:

    • Use a parser on regular expressions making for an inherently fragile solution

    • Only support early versions of RSS

    • Discard all the interesting information besides item title, description, and link

    • Not build proper separation between parsing the RSS and displaying it

    • In particular I failed to find any PHP RSS parsers that could sufficiently parse RSS 1.0 feeds...

Magpie RSS


  • A powerfull RSS parser written in PHP http://magpierss.sourceforge.net

  • Easy to retrieve and render RSS feeds

  • Simple (a few lines of code).

  • Supports all tag sets found in all RSS versions as well as your own made up tags.

  • Low bandwidth usage (caches feed contents for one hour).

Putting Magpie to Work

  1. Download Magpie.
  2. Extract to includes directory.
  3. include magpie/rss_fetch.inc to your script
  4. Use the channel, image, items, and textinput properties of your rss object to display news.

0 Comments:

Post a Comment

<< Home