Grabbing an RSS Feed with PHP

A great way to add content to your site is use syndicated content from blogs, news sites etc with RSS which is Rich Site Summary (some would say Really Simple Syndication, or RDF Site Summary), and is a format used by a variety of sites for content syndication.

This tutorial uses PHP to grab the feed and incorporate it into our site. As it stands we can't do this in Dreamweaver, so we'll make a PHP script and then turn it into an extension so that you can re-use it on other pages. The PHP requires some existing understanding to make sense of, so this tutorial will be hardwork (but not impossible) for PHP newbies.

$2.89
- OR -

Overview

Table of Content:

  • Introduction to RSS
  • Checking XML Functionality is Installed
  • Script Overview
  • Getting the Feed
  • Parsing the Feed
  • The Functions
  • The startTag Function
  • The endTag Function
  • The dataHandler Function
  • Outputting the Information
  • Reusing the Code
  • Taking it Further

Matt Machell

Matt MachellA man of many talents, Matt has been a web designer, technical editor, and jewellery picker. He is currently on contract for the Birmingham City University, producing pages for research centres.

He has tech-edited a dozen books on web design and development for glasshaus, Apress and Sitepoint.

He likes music with loud guitars and games with obscure rules.

His website can be found at: http://www.eclecticdreams.com

He lives in Birmingham with his girlfriend, Frances, and a horde of spider plants.

See All Postings From Matt Machell >>

Reviews

RSS Feed Tutorial

September 25, 2004 by Daniel Lackey

I thought this was a very good and comprehensive tutorial but it would be nice if there was a way to contact the author and/or ask questions. If there already is one, I've apparently missed it. If there isn't, maybe this would be something you may wish to consider.

Thanks for the turorial! I'm already using it.

RE: RSS Feed Tutorial

September 25, 2004 by Matt Machell
Hi Daniel, glad you found the tutorial useful. If you want to email any specific queries, there's a contact form available via my profile (click the link above my photo). Or you can post them here if they're more general. -Matt

Question about configuration

September 25, 2004 by Daniel Lackey

Matt,

I was just wondering if there was a way to set up the default to be target="_blank" ? As it is, I've run across a feed that takes people off of the original site instead.
Thanks!

You must me logged in to write a review.