Magpie PHP RSS parser

Today I discovered the very handy Magpie RSS (GPL licence) RSS feed parser which has these great features:

  • Easy to Use – As simple as: require(‘rss_fetch.inc’); $rss = fetch_rss($url);
  • Parses RSS 0.9 to RSS 1.0, and most other RSS formats, including support for 1.0 modules and limited namespace support. RSS is packed into convenient data structures; easy to use in PHP, and appropriate for passing to a templating system, like Smarty.
  • Integrated Object Cache – Caching the parsed RSS means that the 2nd request is fast, and that including the rss_fetch call in your PHP page won’t destroy your performance, and force you to reply on an external cron job. And it happens transparently.
  • HTTP Conditional GETs – Save bandwidth and speed up download times with intelligent use of Last-Modified and ETag. See HTTP Conditional Get for RSS Hackers
  • Configurable – Makes extensive use of constants to allow overriding default behaviour, and installation on shared hosts.
  • Modular:
    o rss_fetch.inc – wraps a simple interface (fetch_rss()) around the library.
    o rss_parse.inc – provides the RSS parser, and the RSS object
    o rss_cache.inc – a simple (no GC) object cache, optimized for RSS objects
    o rss_utils.inc – utility functions for working with RSS. currently provides parse_w3cdtf(), for parsing W3CDTF into epoch seconds.
    o Secure – supports HTTP authentication, and SSL
    o Bandwidth friendly – supports transparent GZIP encoding to reduce bandwidth usage
    o Does not use fopen(), work even if allow_url_fopen is disabled.

Im currently using it at http://www.algae.info/ to parse the RCI News RSS feed.

Leave a Reply

Your email address will not be published. Required fields are marked *