magpierss.sourceforge.net Open in urlscan Pro
2606:4700::6812:b80  Public Scan

Submitted URL: http://magpierss.sf.net/
Effective URL: https://magpierss.sourceforge.net/
Submission: On August 09 via manual from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

MAGPIERSS: RSS FOR PHP


 * Home
 * Blog
 * Download
 * Features
 * FAQ
 * Links
 * Todo


MAGPIERSS PROVIDES AN XML-BASED (EXPAT) RSS PARSER IN PHP.

MagpieRSS is compatible with RSS 0.9 through RSS 1.0. Also parses RSS 1.0's
modules, RSS 2.0, and Atom. (with a few exceptions)




NEWS!

 * Excited to announce that AOE media, a TYPO3 & Open Source provider from
   Germany has recently agreed to provide continues sponsoring for MagpieRSS.
 * Magpie links page has been rebuilt, and is now driven by del.icio.us
 * The Magpie Blog has been revived and is the place for Magpie news and howtos.
 * Atom support is no longer alpha
   * Download MagpieRSS 0.61
 * Magpie 0.6a (alpha) now available
   * Adds experimental parsing support for Atom
 * Two new sources of MagpieRSS information:
   * MagpieRSS links is a partial list of all the cool stuff people have done
     with Magpie.
 * MagpieRSS 0.52 Now Compatible with PHP 4.3.2
   * Improved socket handling in HTTP library
   * Thanks go to Scott, and Phil for bug reports, and especially to Steve for
     amazing debugging work.
 * MagpieRSS 0.51 Released
   * important bugfix, please upgrade
   * fixes silent failure when PHP is built without zlib support
 * Feed On Feeds Uses Magpie
   * server based PHP RSS aggregator built with MagpieRSS
   * easy to install, easy to use.
 * MagpieRSS 0.5 Released
   * supports transparent HTTP gzip content negotiation for reduced bandwidth
     usage
   * quashed some undefined index notices

   


   WHY?

   I wrote MagpieRSS out of a frustration with the limitations of existing
   solutions. In particular many of the existing PHP solutions seemed to:
    * use a parser based on regular expressions, making for an inherently
      fragile solution
    * only support early versions of RSS
    * discard all the interesting information besides item title, description,
      and link.
    * not build proper separation between parsing the RSS and displaying it.

   In particular I failed to find any PHP RSS parsers that could sufficiently
   parse RSS 1.0 feeds, to be useful on the RSS based event feeds we generate at
   Protest.net
   .

   

   


   FEATURES

    * EASY TO USE
      
      As simple as:
      
      	require('rss_fetch.inc');
      	$rss = fetch_rss($url);
      	
   
    * PARSES RSS 0.9 - RSS 1.0
      
      Parses most 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
      
      * rss_fetch.inc - wraps a simple interface (fetch_rss()) around the
        library.
      * rss_parse.inc - provides the RSS parser, and the RSS object
      * rss_cache.inc - a simple (no GC) object cache, optimized for RSS objects
      * rss_utils.inc - utility functions for working with RSS. currently
        provides parse_w3cdtf(), for parsing W3CDTF into epoch seconds.
   
    * MORE
      
      * Secure - supports HTTP authentication, and SSL
      * Bandwidth friendly - supports transparent GZIP encoding to reduce
        bandwidth usage
      * Does not use fopen(), work even if allow_url_fopen is disabled.

   

   


   MAGPIE'S APPROACH TO PARSING RSS

   Magpie takes a naive, and inclusive approach. Absolutely non-validating, as
   long as the RSS feed is well formed, Magpie will cheerfully parse new, and
   never before seen tags in your RSS feeds.

   

   This makes it very simple support the varied versions of RSS simply, but
   forces the consumer of a RSS feed to be cognizant of how it is structured.(at
   least if you want to do something fancy)

   Magpie parses a RSS feed into a simple object, with 4 fields: channel, items,
   image, and textinput.

   

   CHANNEL

   $rss->channel
   contains key-value pairs of all tags, without nested tags, found between the
   root tag (<rdf:RDF>, or <rss>) and the end of the document.

   

   

   ITEMS

   $rss->items
   is an array of associative arrays, each one describing a single item. An
   example that looks like:

   <item rdf:about="http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257">
   <title>Weekly Peace Vigil</title>
   <link>http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257</link>
   <description>Wear a white ribbon</description>
   <dc:subject>Peace</dc:subject>
   <ev:startdate>2002-06-01T11:00:00</ev:startdate>
   <ev:location>Northampton, MA</ev:location>
   <ev:enddate>2002-06-01T12:00:00</ev:enddate>
   <ev:type>Protest</ev:type>
   </item>
   

   

   Is parsed, and pushed on the $rss->items array as:

   array(
   	title => 'Weekly Peace Vigil',
   	link => 'http://protest.net/NorthEast/calendrome.cgi?span=event&ID=210257',
   	description => 'Wear a white ribbon',
   	dc => array (
   			subject => 'Peace'
   		),
   	ev => array (
   		startdate => '2002-06-01T11:00:00',
   		enddate => '2002-06-01T12:00:00',
   		type => 'Protest',
   		location => 'Northampton, MA'
   	)
   );
   

   

   

   IMAGE AND TEXTINPUT

   $rss->image
   and
   $rss-textinput
   are associative arrays including name-value pairs for anything found between
   the respective parent tags.

   

   


   USAGE EXAMPLES:

   A very simple example would be:

   require_once 'rss_fetch.inc';
   
   $url = 'http://magpie.sf.net/samples/imc.1-0.rdf';
   $rss = fetch_rss($url);
   
   echo "Site: ", $rss->channel['title'], "<br>
   ";
   foreach ($rss->items as $item ) {
   	$title = $item[title];
   	$url   = $item[link];
   	echo "<a href=$url>$title</a></li><br>
   ";
   }
   

   More soon....in the meantime you can check out a
   cool tool built with MagpieRSS
   , version 0.1.

   

   


   TODOS

   RSS PARSER

    * Swap in a smarter parser that includes optional support for validation,
      and required fields.
    * Improve RSS 2.0 support, in all its wacky permutations (as much as I'm
      annoyed by it)
    * Improve support for modules that rely on attributes

   RSS CACHE

    * Light-weight garbage collection

   FETCH RSS

    * Attempt to auto-detect an RSS feed, given a URL following, much like
      rssfinder.pydoes.

   MISC

    * More examples
    * A test suite
    * RSS generation, perhaps with RSSwriter?

   

   


   GETTING HELP WITH MAGPIE

    * Read the Frequently Asked Questions
    * Read How to Get Help with MagpieRSS
    * Read over the How To section on the links page, to see if an existing
      solutions work for you.
    * Read over the mailing list archives
    * Subscribe to magpierss-general and ask your question.

   

   


   RSS RESOURCES

    * RSS Tutorial for Content Publishers and Webmasters is a great place to
      start.
    * RSS Workshop: Publish and Syndicate Your News to the Web is also a good
      introduction
    * Finding More Channels on how to find RSS feeds.
    * The Mapgie FAQ and Links pages can be very useful.
    * RSS-DEV mailing list is generally a very helpful, informative space, with
      the occasional heated debate
    * RSS Validator

   

   


   LICENSE AND CONTACT INFO

   Magpie is distributed under the GPL license...

   Questions, and suggestions, magpierss-general@lists.sf.net

   coded by: kellan (at) protest.net, feedback is always appreciated.

   Development sponsored in part by AOE media, a TYPO3 & Open Source provider
   from Germany.