Archive for the 'php' Category

O’Reilly’s “How to Build an RSS 2.0 Feed”

Friday, November 10th, 2006

O’Reilly (the company, not Tim) asked me to put together a Short Cut on building RSS 2.0 feeds. The intended audience is people who would like a nice starter guide to building feeds and best practices, but don’t want to invest in a printed book just yet.

How to Build an RSS 2.0 Feed

How to Build an RSS 2.0 Feed

Something unique to this piece is the stated intent to follow the RSS Advisory Board’s profile recommendations as much as possible. (AFAIK this is the first commercially-published work to do so.)

I’d like to repeat my hearty thanks to James Snell and Simon St. Laurent for their contributions.

The title page doesn’t give much of a sense what is inside, so I thought it might be helpful to give a full table of contents. The “Anatomy” chapter in particular goes through every RSS element in detail, giving examples of usage and identifying best practices where applicable.

HOW TO BUILD AN RSS 2.0 FEED
TABLE OF CONTENTS

Chapter 1: How an RSS Feed Works

  • RSS and Other Syndicated Feed Formats
  • XML: The Foundation of RSS
  • The Basics of XML
  • Digging Further into XML
  • XML and the RSS 2.0 specification
  • The RSS Advisory Board

Chapter 2: Anatomy of an RSS 2.0 Feed

  • The RSS Document
  • The channel Element
  • [… Each subelement of channel; too many to list …]
  • The item Element
  • [… Each subelement of item; too many to list …]

Chapter 3: RSS Best Practices

  • Cascading Style Sheets in RSS
  • JavaScript in RSS
  • Validating Your RSS Feed
  • Browser-Friendly Feeds
  • Using XSLT
  • Third Party Hosting

Chapter 4: Building RSS in Code

  • PHP 4
  • Java 1.4 with JAXP
  • Java 1.4 with ROME
  • Podcasting with RSS

Chapter 5: Podcasting with RSS Modules and Extensions for RSS

  • Dublin Core
  • Content
  • CommentAPI
  • Geo
  • Apple iTunes

Chapter 6: Great Ideas for Using RSS

  • Blog Engines
  • News
  • Shopping
  • Government and Public Service
  • Weather Updates

Index of Terms

Build an AJAX RSS reader

Friday, October 20th, 2006

With a tiny bit of PHP on your webserver, Kris Hadlock shows you how to go about building an RSS aggregator in AJAX. (Kris is the author of Ajax for Web Application Developers.)

The sample code is a very simplistic reader, but the tutorial is well-written and the code is clean.. extending the functionality to read Atom feeds would be a cinch. The PHP is needed, of course, to act as a cross-domain proxy for any feeds not on your own webserver. (JavaScript isn’t allowed to make off-domain requests.)

A working demo of the tutorial code can be found here.

FeedBurner FeedFlare for Surveys

Thursday, July 27th, 2006

I was perusing FeedBurner’s “101 FeedFlares For a Better Tomorrow” list and saw that the “Survey” category was unattempted.

JotForm is a (free for now) online form builder that lets you build your own survey, contact form, or whatever. Perfect.

I put together a simple PHP generator which (with a couple of RESTful parameters) will create a customized FeedFlare for anyone who wants to add a JotForm survey FeedFlare link to their FeedBurner feed:

http://flare.markwoodman.com/jotform.php

The generator is intended for people not comfy crufting together a URL with properly escaped ASCII. You simply enter the link text you want (”Survey!” or “Talk Back” or “Eat Much?” and the JotForm form id, and it will build the URL for you.

The “demo” parameter will output a sample XML that fits the FeedFlare structure: http://flare.markwoodman.com/jotform.php?demo=true.

It’s fun to see how easy Immediate Actions can be these days. I hope some people get good use out of this one.

Watch a FTP server with RSS

Thursday, March 23rd, 2006

Monitor FTP with RSSI was recently collaborating with a friend on a little project where we used an FTP server to store and exchange files. It worked well, but I found myself frustrated that I had to manually check the server for new files or wait for a heads-up email from my friend.

“What I really need”, thought I, “is an RSS feed that tells me when files are added or changed.”

After a bit of searching, I didn’t find anything that fit what I was looking for. For some reason the world hasn’t been anticipating my needs lately. (Somebody check on that, will you?)

So I decided to write a PHP script to get the job done. I’m not a PHP guru, but the task was straight-forward and I had something usable in short order.

Now that I have the script working fairly well for multiple FTP servers, I have written a tutorial on xml.com that shares the code and shows how it works:

RSS Feeds for FTP Servers
RSS Feeds for FTP Servers

The script is intentionally generic, but it could easily be tailored and used for more specific means or specific servers. If you find it useful, have cool modifications to it, or (like as not) find a bug, please let me know. I’d love to hear from you.