Home arrow PHP arrow Page 4 - Web Services

RSS Syntax - PHP

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).

TABLE OF CONTENTS:
  1. Web Services
  2. Why Web Services?
  3. Real Simple Syndication
  4. RSS Syntax
By: Apress Publishing
Rating: starstarstarstarstar / 1
July 22, 2010

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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).

Listing 20-1. A Sample RSS Feed (blog.xml)

<?xml version="1.0" encoding="iso-8859-1"?>
   <rss version="2.0">
   <channel>
     
<title>Inside Open Source</title> 
      <link>http://opensource.apress.com/ </link>

   <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.



 
 
>>> More PHP Articles          >>> More By Apress Publishing
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap

Dev Shed Tutorial Topics: