RSS API for building a feed in PHP

Ara is a PHP class to generate RSS 2.0 feeds.

It is easy to use: some calls to methods to create the feed and to add items, from URLs...

Using the ARA class

An instance is created:

$myfeed = new ara();

and properties and methods are associated to this instance...

Properties of the class

They allow to change the parameters of the feed. For example, to assign the size of the snippets:

$myfeed->DESC_SIZE = 500; 
Size of the description. The final size can vary as the code will try to cut the description at a dot, when possible.
Maximal number of items in the feed.
Adding items at the beginning so users can view last news at first.

ARA methods

For creating an RSS feed from raw data. Function to display the feed are not included, this is done by other scripts such as RSS Reader or Common Reader.

Constructor. No argument.
ARAFeed(title, link, description, date)
Creates a new feed and add a channel from data given in arguments.
Extracts data of the channel (the site) whose URL is given, the home page of the site in order, and calls the ARAFeed method.
ARAItem(title, link, description, date)
Adds an item, built from the given arguments.
compress(size = -1)
Reduces the number of items in the feed to the given size. If not parameter is given, uses the value of FEED_MAX.
Removes an item give, in argument in DOMNode format used by PHP.
Loads an RSS file and builds the tree in memory as a DOMDocument.
Saves the RSS feed into a file.
Returns the feed in a string.
Extracts the title and description of an HTML page whose URL is given. Returns a simple array with the title, description, and date of the day.
The method is able to retrieve the data either from meta tags or from the body de la page.


All the functions of the API are in the ara-class.php file.

This file is included in the ARA RSS Editor and in the Bioloide online tool.