MySQL
  Home arrow MySQL arrow Creating an RSS Reader: the Reader
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MYSQL

Creating an RSS Reader: the Reader
By: Jacques Noah
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 10
    2007-02-06


    Table of Contents:
  • Creating an RSS Reader: the Reader
  • XML-related Functions
  • The Meat of the Code
  • Reading RSS Data from a Database (Optional)

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Creating an RSS Reader: the Reader
    ( Page 1 of 4 )

    In this article we are going to discuss how to create a PHP-based RSS reader. It would be helpful if you know something about XML, but not really necessary. RSS documents have three main tags: Title, Link and Description. And they all do exactly what their names suggest. I will go into detail about these tags in my second article dealing with “building an RSS file.” For now, we will only focus on the “reading” part of the article.
    A downloadable file is available for this article.

    As an extra I will introduce a database aspect of the reader. We will use the database to store and retrieve the latest stories. To continue with this article you will need PHP 4 and higher and optionally MYSQL.

    Below is an example text from an RSS document:

                                Start example text

    <item>

          <title>First example</title>

          <link>www.mylink.com/someplace.html</link>

                <description>Some description, blah,blah,blah
    </description>

        </item>

        <item>

          <title>Thousands set to attend todays celebration</title>

          <link>http://
    www.mylink.com/someplace.html /NewsTopStories?m=318</link>

          <description>blah,blah,blah </description>

        </item>

                                 End example text

    Code

    To create an RSS Reader in PHP, we need to:

    1. Create a function to read the start tag (start element).
    2. Create a function to read the end tag (endElement).
    3. Create function to read the text associated with the tags.

    A typical RSS document will have the following structure: 

    <RSS>

        <channel>

             <item>

            </item>

       </channel>

    </RSS>

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



     
     
    >>> More MySQL Articles          >>> More By Jacques Noah
     

       

    MYSQL ARTICLES

    - MySQL Security Tips
    - Designing a MySQL Database: Tips and Techniq...
    - The Three Most Important MySQL Queries
    - Null and Empty Strings
    - MySQL Server Tuning Tips and Tricks
    - MySQL Query Optimizations and Schema Design
    - MySQL Benchmarking Tools and Utilities
    - MySQL Benchmarking Concepts and Strategies
    - Take Some Load off MySQL with MemCached
    - MySQL Table Prefix Changer Tool in PHP
    - Using the SIGNAL Statement for Error Handling
    - Error Handling Examples
    - Error Handling
    - Completing a Search Engine with MySQL and PH...
    - Paginating Result Sets for a Search Engine B...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    Stay green...Green IT