Grouper: Convert news searches and other web pages to RSS newsfeeds

Grouper: RSS Generator - Documentation

     Version 1.4.3 (7/15/2005)

This documentation has been replaced. The new documentation is available here.

Download | Install | Configure | Functions | Grouper Evolution Plugins | Atom Example | News Example | Associates Program

Example Code: Convert Atom to RSS

Use the following code to convert an Atom 0.3 feed to RSS using Grouper Evolution. To convert an Atom 1.0 feed, change the GrouperLoadPlugin line to load 'xml-atom-1.0.php' (included with Grouper 1.4.3 or later) instead of 'xml-atom-0.3.php'. Grouper does not auto-detect the version, so you must load the correct plugin. The following should be the entire contents of the file. Change "http://www.example.com/atom.xml" to the URL of the Atom feed you wish to convert, and "PATH/TO/GROUPER" to the path to your Grouper installation.

<?php
$feedurl='http://www.example.com/atom.xml';
require_once '/PATH/TO/GROUPER/grouper.php';

GrouperLoadPlugin('xml.php');
GrouperLoadPlugin('xml-atom-0.3.php');
GrouperSourceURL($feedurl);
GrouperShow('',md5($feedurl));
?>


NOTE: If you are using Grouper 1.4.2 or earlier, you must replace the call to GrouperSourceURL with the following three lines of code:

preg_match('#.*//(.*?)(/.*)#',$feedurl,$matches);
GrouperSourceConf('searchdomain',$matches[1]);
GrouperSourceConf('querystart',$matches[2]);


Use the following code to convert an Atom feed to RSS using Grouper Evolution, and CaRP to convert it to HTML, all within the same file. This code can be embedded in the middle of an HTML page. Note that the filename extension must be ".php" unless you have enabled PHP processing of filenames with other extensions. Change "http://www.example.com/atom.xml" to the URL of the Atom feed you wish to convert, "PATH/TO/GROUPER" to the path to your Grouper installation (in two places), and "PATH/TO/CARP" to the path to your CaRP installation.

<?php
$feedurl='http://www.example.com/atom.xml';
require_once '/PATH/TO/GROUPER/grouper.php';

GrouperLoadPlugin('xml.php');
GrouperLoadPlugin('xml-atom-0.3.php');
GrouperSourceURL($feedurl);
GrouperShow('',md5($feedurl),0);

require_once '/PATH/TO/CARP/carp.php';

// add any configuration you want here to control the appearance of the output
// see the CaRP documentation for details


CarpShow('/PATH/TO/GROUPER/rsscache/'. md5($feedurl));
?>