code to generate RSS feeds

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm using PHP 4.4.4 with Apache 2.2.  I'm looking for recommendations
on free code I can use to generate RSS feeds.  I found FeedCreator
though Google, but that is terrible.  It cannot output dates correctly
and it displays a bunch of warnings/notices, even though I never
touched their code.

Thanks for your advice, - Dave

Re: code to generate RSS feeds

On Feb 12, 9:21 am, ""
Quoted text here. Click to load it

A few months ago, I posted to alt.php on a simlar topic:

If you have any questions after reading that post, shoot me an e-


Re: code to generate RSS feeds wrote:

Quoted text here. Click to load it

Here's the class I use for my current project. /*checkout*/demiblog/trunk/blog/includes/Feed.class?revision=73&content-type=text%2Fplain

It's uses PHP 5, but it should be reasonably simple to backport to PHP 4.

Basic technique is:

    require_once 'Feed.class';
    $type = 'rss';

    $feed = Feed::factory($type);
    $feed->title     = 'Example';
    $feed->url       = ' /';
    $feed->summary   = '<p>Here is <b>my</b> site. It is nice.</p>';
    $feed->langguage = 'en_GB';
    $feed->add_item('Article 1',
            ' ',
            '<p>Article 1 is lovely.</p>');
    $feed->add_item('Article 2',
            ' ',
            '<p>Article 2 is even <b>better!</b>.</p>');
    $out = $feed->output();

    header("Content-Type: text/xml");
    print $out;

It supports:

    - RSS 0.91
    - RSS 1.0 (RDF)
    - RSS 2.0 (with or without HTML descriptions)
    - Atom 1.0 (with or without HTML descriptions)
    - HTML/hCalendar
    - iCalendar
    - JSON
    - PHP serialize()
    - Text (CSV)

as output formats. It is reasonably easy to add support for other formats.

Toby A Inkster BSc (Hons) ARCS
Contact Me ~
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

Re: code to generate RSS feeds


on 02/12/2007 03:21 PM said the following:
Quoted text here. Click to load it

You may want to take a look at this popular RSS feed generation class.
It supports generating feeds in either RSS 0.9, 0.91, 1.0 and 2.0:

You need to use it in conjunction with this other class:


Manuel Lemos

Metastorage - Data object relational mapping layer generator

PHP Classes - Free ready to use OOP components written in PHP

Re: code to generate RSS feeds

Quoted text here. Click to load it

I've used Manuel Lemos's classes, and I like them a great deal. they
are clean and easy to use.

-- Lawrence Krubner

Site Timeline