CS 55.13 - PHP Programming
Section 4191
David Pearson
Fall 2009

Assignment 17.01

XML - RSS feed and RSS Parsing

In this assignment you will write 2 small PHP programs. Develop your code in the "assn17" directory.


Preparation

Copy all of your Assignment 16 code from the assn16 directory to the assn17 directory.


Part 1 - RSS Feed Generator

For this part of the assignment, you will build a PHP script that generates an RSS feed from your blog's posts. The output will be all XML, there will not be any HTML in your output.

Follow the "PHP and RSS: Getting it together" (local mirror) article on how to generate RSS from a PHP program.

RSS Feed Generator Requirements

  1. Name your RSS Feed Generator script "rss.php".
  2. The generated RSS feed XML must include
    1. Channel components
      1. a title that match the name of your blog
      2. a link to your blog
      3. a short description of your blog
    2. Item components
      1. the blog post title as the item's title
      2. the blog post body as the item's description
      3. the URL (full) to the post detail page as the item's link

    You may include any other RSS XML elements, provided the element content is valid. For example, the "language" element has specific values permitted and the "pubDate" has a specific date format that is to be use. Google for RSS specification details or see http://cyber.law.harvard.edu/rss/rss.html#requiredChannelElements for more.

  3. Your RSS feed must validate. Use http://validator.w3.org/feed/
  4. Include all of the posts on your blog.
  5. The blog posts should be ordered such that the most recent blog posts are at the begining of the RSS feed and the oldest posts are at the end.
  6. As shown in the article's "Getting the word out" sidebar, add the HTML link tag to your blog's home page. Test it in a browser.
  7. No HTML in your output.

Part 2 - RSS Parsing

For this part of the assignment you will build a standalone script that generates an HTML page from an RSS feed. Your script does not need to be part of your blog. You may integrate it into your blog, but it is not required.

Find an RSS feed on a blog somewhere out on the internet. Using the techniques from Chapter 28 of the book, generate an HTML page from the RSS feed. You may wish to review http://php.net/manual/en/domdocument.load.php for more info on the DomDocument class and http://php.net/manual/en/function.simplexml-load-file.php for more info on the simplexml_load_file function. Make sure the output validates.

Things I'll be looking for

Turn in

Upload all your code to the "assn17" directory of your account on the Student Server. Test it. Make sure it works.

In the form below include the URL for your RSS Feed Generator script and the URL to your HTML page generated from the external RSS feed.


(Required)
(Required)
(Required)
(One URL per line, complete URLs only i.e. http://student.santarosa.edu/~dpearson/2009fall/cs5513/assnXX/foo.php)
(Required)
(One file per line, fully qualified i.e. /home/WWW_pages/dpearson/2009fall/cs5513/assnXX/foo.php)
(Required)
 Action 

Valid XHTML 1.0 Strict Valid CSS! Updated at: November 23, 2009 9:21 pm