This five-part article series will introduce you to Web Services. If you've ever wanted to incorporate them into your web sites, this is a good place to start. This article is excerpted from chapter 20 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 1590597702).
If you’re not familiar with the general syntax of an RSS feed, Listing 20-1 offers an example that will be used as input for the scripts that follow. Although a discussion of RSS syntax specifics is beyond the scope of this book, you’ll nonetheless find the structure and tags to be quite intuitive (after all, that’s why they call it Real Simple Syndication).
<item> <title>Killer Firefox Tip #294</title> <link>http://opensource.apress.com/ article/190/</link> <author>W. Jason Gilmore</author> <description>Like most of you, I spend bunches of time downloading large files from the Web, typically podcasts and PDF documents...</description> </item>
<item> <title>Beginning Ubuntu Linux wins Linux Journal Award!</title> <link>http://opensource.apress.com/ article/189/</link> <author>Keir Thomas</author> <description>Woo hoo! My book, Beginning Ubuntu Linux, has won an award in the Linux Journal Editor's Choice 2006 awards! More precisely...</description> </item>
<item> <title>Forms Validation with CakePHP</title> <link>http://opensource.apress.com/ article/188/</link> <author>W. Jason Gilmore</author> <description>Neglecting to validate user input is akin to foregoing any defensive gameplan for containing the NFL's leading rusher. Chances are sooner or later...</description> </item> </channel> </rss>
This example doesn’t take advantage of all available RSS elements. For instance, other feeds might contain elements describing the feed’s update interval, language, and creator. However, for the purposes of the examples found in this chapter, it makes sense to remove those components that have little bearing on instruction.
Now that you’re a bit more familiar with the purpose and advantages of RSS, you’ll next learn how to use PHP to incorporate RSS into your own development strategy. Although there are numerous RSS tools written for the PHP language, one in particular offers an amazingly effective solution for retrieving, parsing, and displaying feeds: MagpieRSS.
Please check back next week for the continuation of this article.