sites,  WordPress

MagpieRSS, a PHP Based RSS Parser

RSS is an incredibly powerful way to manage content. Using RSS you can provide a feed to users and your website simultaneously.  You can then have items your site, such as WordPress dynamically generate pages for browsers using items published in the feed and have users able to view the feed without seeing the rich media objects that you might also put on the site.

A basic RSS feed might include something like the following:

<item>

<title>My Article</title>

<link>http://https://krypted.com//article1</link>

<description>Some article on my site.</description>

</item>

Each of the above items is a field that has been defined in the rss file that is used to view your feed, similar to an LDAP schema, headers on an Excel spreadsheet or table headers in a database.  MagpieRSS is a php script that parses these RSS feeds. It is fast, flexible and can be as easy to integrate into your site as:

require(‘rss_fetch.inc’);
$rss = fetch_rss($url);

There are 4 scripts in Magpie (so I guess it’s more of a framework really):

  • rss_fetch.inc – gets an object or array of objects from an RSS feed.
  • rss_parse.inc – parses an RSS object, and therefore provides flexibility in dealing with the feed.
  • rss_cache.inc – caches RSS objects.
  • rss_utils.inc – provides other basic functions of dealing with RSS originated objects.

Magpie can then be inserted into a page and display the items in feeds, even multiple feeds if you have content from a few different sites you would like to display.  You can also parse this information, so that you should articles that have a specific pattern in them.  This allows for syndication of content across a number of systems.