ReachRSS includes a powerful PHP class that allows you to tap into the capabilities of RSS without writting your own RSS engine / caching system.

While we fully encourage you to extend ReachRSS for your own purposes, please keep in mind that ReachRSS is a commercial product and unless you purchase a special redistribution license you are not permitted to distribute ReachRSS with your own code. You could, however, distribute your code seperately and require that the user obtain their own licensed copy of Reach!

The ReachRSS Class

The ReachRSS PHP Class is designed to allow you to programatically tap into the ReachRSS engine and perform any of the admin functions you could manage from the admin UI and more! Using this class you can keep your feeds up to date without tracking update times, cacheing results, and parsing RSS XML. All you need to do is create a ReachRSS class and call the functions you wish to use - Reach takes care of managing the RSS feeds and keeping them up to date.

Getting Started

The first thing you need to do in your PHP code is to include the reachrss.php file and create a new instance. You can do this with:

require_once("reachrss.php");
$ReachRSS = new ReachRSS();

This gives you a new object ($ReachRSS) to work with your RSS feeds. It's now highly recommended that you call one of the startup(), output(), or save() functions. Without calling one of these functions you will have to do everything manually.

Startup loads existing data, checks all existing channels, and updates any that need updating. To call Startup use:

$ReachRSS->startup();

Now your channels are all up to date and you're ready to manipulate the class in whatever way you like. You can skip to the function descriptions below if you like.

If however, you want to simply output the template to your browser or to a file, ReachRSS offers an easy way to do both of these things without having to bother with the Startup call or any other functions. Output calls Startup() automatically and then parses the template and outputs it to the browser. To call Output instead of Startup use:

$ReachRSS->output();

Save does the same as output, but it sends the completed template to a filename you specify. To call Save instead of Startup or Output use:

$ReachRSS->save("/path/to/filename");

 
ReachRSS Public Functions

There are several functions that you will commonly use to obtain data from your RSS feeds using Reach. Remember that ReachRSS handles multiple channels (RSS feeds) at the same time, so most functions require a "ChannelURL" property when requesting data. Without this Reach wouldn't know which channel you want information on.

ReachRSS()       Creates and initializes the ReachRSS class. This function is called automatically when you use new ReachRSS()
     
add_channel()   Adds a new channel to ReachRSS (subscribes ReachRSS to a new RSS/RDF feed)
admin()   Display the ReachRSS HTML Admin Interface
cached_image()   Outputs the locally cached image to the browser
channels()   Returns an array of all existing channels
channel_property()   Get the string value of a channel property
channel_exists()   Checks if the specified channel exists (if it's subscribed to) or not
channel_image_url()   Returns the locally cached image URL for the requested channel
channel_image_type()   Returns the mime-type of the channel's image
data_filename()   Sets the filename to use with load_data() and save_data()
item_count()   Returns the number of items contained in the specified channel
item_exists()   Checks if the specified item exists in the specified channel or not
item_ids()   Returns an array of valid item ids for the specified channel
item_property()   Get the string value of an item's property
load_data()   Loads cached data from the default data file or from the specified filename
max_items()   Sets the maximum number of items to keep per channel
max_time()   Sets the maximum number of seconds to keep each item in the cache
min_cache_time()   Sets the minimum number of minutes before refreshing channels
output()   Loads cached data and refreshes any channels that need refreshing then sends the parsed template to the browser
remove_channel()   Removes an existing channel from ReachRSS (unsubscribes ReachRSS from an existing RSS/RDF feed)
save_data()   Saves updated data to the default data file or to the specified filename
save()   Loads cached data and refreshes any channels that need refreshing then saves the parsed template to the specified file
startup()   Loads cached data and refreshes any channels that need refreshing
template_cache_time()   Sets the number of seconds to cache parsed template
template_filename()   Sets the template file to use
update_channel()   Reloads / refreshes the specified channel
update_all_channels()   Reloads / refreshes all subscribed channels and saves
     

 

Home | Features | Samples | Demo | Download | Register | Help / Support