Some time ago, I wrote a blog portal in PHP, that used MagpieRSS 0.72. Unfortunately, there are plenty of bugs in MagpieRSS, and it has no support for the newer format Atom 1.0. MagpieRSS hasn’t been updated since November 2005, so I improved on it myself. I have emailed my patches to Kellan, the maintainer of MagpieRSS, but I got no reply.

NOTE: I don’t use this code anymore, so don’t ask me for further fixes or improvements. I’m only publishing the code here, so that someone else may create a new project or take over the SourceForge project for MagpieRSS or something. It’s all open source, baby.

My improvements to the fetcher:

  • Changed the name of the HTTP header from “If-Last-Modified” to the correct “If-Modified-Since” (this is very important, since your client will fetch feeds unnecessarily often otherwise)
  • Made sure that the constant MAGPIE_CACHE_FRESH_ONLY actually works — it doesn’t in the original version
  • Allows you to fetch feeds with the POST method as well as GET
  • Trimming values from the headers “ETag” and “Last-Modified”
  • Removed “Undefined property” warning messages for MagpieRSS::$etag and MagpieRSS::$last_modified

My improvements to the parser:

  • Assumes version 1.0 if the format is Atom with no version
  • Handles Atom links with different “rel” types better
  • Reads the “subtitle” tag if Atom 1.0
  • Reads the “published” and “updated” tags if Atom 1.0
  • More stable when encountering illegal characters (I actually don’t remember what I meant by this!)

My improvements to the utils:

  • Fixed bad regular expression to correctly match seconds in W3CDTF timestamps

I also replaced the bundled version of Snoopy (1.0) with a newer version (1.2.4).

Again, note that this release is inofficial and not very well-tested. But the original is discontinued, so I guess it’s better than nothing.

download Download Improved MagpieRSS

2 Responses to “Improved MagpieRSS”

  1. Pihtt Says:

    Thank you very much. It resolves my notice :
    Undefined property: MagpieRSS::$etag
    (rss_fetch.inc)

    Wonderful!

  2. Aaron Newton Says:

    Sorry to be a pain.

    I just opened this up in Eclipse and noticed some errors. I know you’re not maintaining this code, but thought it might be useful for your users.

    Errors:

    scripts/magpie_slashbox.php, line 10 (missing closing >)
    scripts/magpie_simple.php, line 26 ( tag needs to be on line below).

    Neither are a big deal technically speaking, but could much up the markup and cause confusion.

Leave a Reply

Powered by WP Hashcash