Plugging RDF Content Into Your Web Site With PHP - Have Content, Will Syndicate (
Page 2 of 9 )
We'll start with the basics - what the heck
is RSS anyhow?
RSS (the acronym stands for RDF Site Summary) is a format
originally devised by Netscape to distribute information about the content on
its My.Netscape.Com portal. The format has gone through many iterations since
its introduction in early 1997 - take a look at the end of this article for
links to information on RSS's long and complicated history - but seems to have
stabilized at RSS 1.0, an RDF-compliant version that is both lightweight and
full-featured.
RSS makes it possible for webmasters to publish and
distribute information about what's new and interesting on a particular site at
a particular point in time. This information, which could range from a list of
news articles to stock market data or weather forecasts, is published as a
well-formed XML document, and can therefore be parsed, processed and rendered by
any XML parser.
By making it possible to distribute a frequently-updated
list of the latest information about a particular Web site, RSS opens the door
to simple, easy content syndication over the Web. In order to understand how,
consider the following simple example:
Site A, a news site (a "content
syndicator"), could publish, on a hourly basis, an RSS document containing a
list of the latest news from around the world, together with links to the full
article on the site. This RSS document could be picked up by another Web site
(Site B, a "content aggregator"), parsed, and displayed on Site B's index page.
Every time Site A publishes a new RSS document, Site B's index page
automatically gets updated with the latest news.
This kind of arrangement
works for both organizations involved in the transaction. Since the links within
the RSS document all point to articles on Site A, Site A will immediately
experience an increase in visitors and site traffic. And Site B's webmaster can
take the week off, since he now has a way to automagically update his index
page, simply by linking it to the dynamic content being published by Site
A.
Quite a few popular Web sites make an RSS or RDF news feed available
to the public at large. Freshmeat, (
http://www.freshmeat.net) and Slashdot (
http://www.slashdot.org) both have one, and
so do many others. I'll be using Freshmeat's RDF file extensively over the
course of this article; however, the techniques described here can be applied to
any RSS 1.0 or RDF file.