exception. 2. The library is visiting various housebound readers at home. This is on the schedule so the times of this activity are specified but the location is not. 3. The library is at a "normal" stop. We get the arrival/departure times and location for this. 4. The library is between stops or back at base. */ define('ENDPOINT', 'http://projects.adrianshort.co.uk/sutmoblib/location.php'); $result = json_decode(file_get_contents(ENDPOINT)) or die("Couldn't access the API"); if (isset($result->exception)) { $message = sprintf("%s: The library is not running today.", $result->exception); } elseif ('HOUSEBOUND' == $result->stop->type) { $message = sprintf("The library is currently visiting housebound readers around the borough until %s.", $result->stop->depart_12); } elseif ('NORMAL' == $result->stop->type) { $message = sprintf("The library is at %s, %s. It will be there until %s.", $result->stop->location->street, $result->stop->location->town, $result->stop->depart_12); } else { $message = "The library is between stops or back at base."; } ?> Sutton Mobile Library API Example

API Result

Sutton Mobile Library schedule