Information for Webmasters


» Introduction
» Flag Status
» Lighting Times
» Websites on the SRCF (incl. code examples.)
» Drupal


The following information is aimed at College club webmasters who want to incorporate CUCBC data into their site. This page defines how CUCBC make this data available and includes a limited set of examples (using PHP) showing how to deploy this information to other sites. In general CUCBC cannot help individual webmasters/clubs with setting up such systems unless there is a technical problem with data provided by CUCBC.

Flag Status

You can access the current flag status from one of two files:


These files give the current flag status as a three letter code:

nopNot OperationalUsed during vacations.
bluCambridge Blue

Lighting Times

Lighting times for today and tomorrow can be accessed from one of two files:


The text file is formatted as follows:
2Lighting Down TodayHH:MM (24 hr)
3Lighting Up TodayHH:MM (24 hr)
4Lighting Down TomorrowHH:MM (24 hr)
5Lighting Up TomorrowHH:MM (24 hr)

The scheme for the XML file is self explanatory from element/attribute names.

Long term lightings data is available in XML and CSV format:

» XML Data for 2008
» CSV Data for 2008

The data is formatted as follows:

2Lighting Down (Timestamp)UNIX Timestamp
3Lighting Up (Timestamp)UNIX Timestamp
4Lighting Down (Friendly)HH:MM
5Lighting Up (Friendly)HH:MM

The PHP date() function can be used to format the timestamp values in whatever date/time format is required. The "friendly" values give 24-hour clock times for lighting down and up.

NB: The date_sunrise() and date_sunset() functions available in PHP 5 will only generate approximations to CUCBC Lighting Times.

Websites on the SRCF

The SRCF does not allow PHP to access external files so we have made the four files listed above available locally on the SRCF machine.

The SRCF copies of these files are updated automatically every 4 minutes.

The absolute paths to these files are as follows:

\societies\rowing\river_status\flag.txt \societies\rowing\river_status\flag.xml \societies\rowing\river_status\darkness.txt \societies\rowing\river_status\darkness.xml

Code Example

This snippet exemplifies how SRCF hosted websites can retrieve the flag status-code using PHP:

// Only works on the SRCF.
// Gets data that is, at most, 4 minutes old.
$fp fopen($filename'r');
$flag fread($fpfilesize());
// $flag now contains the three-letter flag status code.

A suitable set of if...else blocks or a switch can now be used to produce relevant HTML based on the flag status.

The example below uses a switch block:

switch ($flag) {

// Print HTML code to display green flag image/message.

// Print HTML code to display yellow flag image/message.
// Print HTML code to display 'flag status unavailable' message.


Disclaimer: CUCBC provides the above examples "as is" and cannot guarantee their accuracy, effectiveness, security or operation. Please see the PHP Manual for more detailed PHP documentation.


A Drupal module is available that will provide a block displaying the current flag status along with today and tomorrow's lighting times. The data are obtained from the text files on the CUCBC web server (see above).

» CUCBC River Status Drupal Module

To install, extract the archive to your Drupal install's modules directory then move the [modules]/riverstatus/flag directory to /img/flag in your document root. The module will work with Drupal 5.x and 6.x.

© 2001 - 2023 Cambridge University Combined Boat Clubs. All rights reserved.