. Updated Daily. Editions SDA India   SDA Indonesia
BUSINESS ENTERPRISE SOLUTIONS ARCHITECTURE INFORMATION SECURITY WIRELESS & MOBILITY DATA & STORAGE DEVELOPMENT HARDWARE













News

Saturday, 10 February 2007

Article: How to Create an RSS Reader in PHP?

 

 

Jacques Noah over at Devshed has posted an article where he discusses how to create a PHP-based RSS Reader. He informs you about RSS documents three main tags— title, link and description. They perform the same functions as their names suggest. He says to implement the contents in the article; a version of PHP4 and higher and optionally supporting MySQL is required.

He illustrates with two code examples from an RSS document. He divides the examples into two parts— start example text and end example text. The start example tag is explained with a code whereas end example code he describes the steps to create an RSS reader in PHP:

  • Create a function to read the start tag (start element)
  • Create a function to read the end tag (endElement)
  • Create function to read the text associated with the tags.
  • He shows with a code the structure of a typical RSS document in the following:

<RSS>
<channel>
<item>
</item>
</channel>
</RSS>

He describes the start and the end tags that he uses in the code. He says, start tag is a tag without the ‘/’ character, for example <items>. An end tag is a tag with the ‘/’ character, for example </item>.So the start and end tag functions will search for the ‘<item></item>’ tags and once they have found those, it will be a simple matter of retrieving the text data from them to display.

He also talks about XML-Related functions that PHP provides in creating this RSS Reader. He uses various XML-Related functions to make the concept clear.

After the required functions are created, he deals with the meat of the code. The function used in the code calls both the startTag/endTag functions to loop through the XML file and displays the contents too.

He also shows an optional way to read the information when the RSS reader is not available. He creates a database to store the RSS data. It also helps to update the RSS file through the use of the database. He provides tables and code specimens to form this database.

 

Read the Article

 
 
print save email comment

print

save

email

comment

 
 

Search SDA Asia

Free eNewsletter

SDA Asia Magazine Free Download
 
 
 
Copyright @ 2008 SDA Asia Magazine - All Right Reserved Privacy Policy | Terms of Use