Next Previous Contents

4. APC rss aa module Client

4.1 Requirements for the client

The rss aa module client is the program which polls remote nodes for new items on a regular basis.

The rss aa module client must perform the following tasks:

4.2 Specification Detail

Running on a regular basis

The rss aa module client is implemented in a new file xmlclient.php3.

The program is expected to run on a regular basis. As a rule of thumb, we expect this interval to be 15 minutes. Because of the fact that the php scripts must be run through the http server, we need to implement the same mechanism as described in the APC Action Applications: E-Mail Subscription Service Specification, chapter 5, section 5.1 and 5.2 ( email-spec-5.html). The task described there is to run a program daily. the same mechanism should be used to run a program every 15 minutes.

Helper function: The XML parser

The XML parser should be put into an include file (name probably include/xmlparse.php3. It is used at two spots, from the rss aa module client specified in this chapter and from the administrative interface to establish a new incoming feed.

When a request has been made to a rss aa module server, the response is expected to be an xml document. PHP's xml functions are able to parse this result. The PHP xml functions are documented in the PHP 4 manual.

Using the PHP xml functions, a rss aa module parser function is created. Its name is apcrss_parse. The function takes a string containing the xml data to be parsed as an argument. It returns an array containing the result.

The parser function uses at least the PHP functions xml_parser_create, xml_set_element_handler, xml_set_character_data_handler, xml_parse and xml_parser_free.

The return value is an array containing all information that was in the xml data. The actual data structure within this array is not yet specified.

In cases of xml syntax errors, return the error message from the xml parser.

XML fetcher

In a new include file include/xml_fetch.php3, a function xml_fetch to fetch an xml data file through http is created. This function is used by the rss aa module client described in this chapter as well as by the administrative interface.

The function takes these arguments:

string url

The url to which the connection is to be made.

string parameters[]

Array containing the parameters that are to be posted with the http request.

The functions returns the received data in a string. On error, the function returns an empty string or, if available, an error message in the string which does not start with a '<' character.

The function

The tasks

On execution, the script selects all incoming feeds from table external_feeds . The query must join

The program then loops through all feeds. All the following tasks are done for each feed respectively.

For each feed,


Next Previous Contents