<!DOCTYPE html>
<html lang="en">
<head>
<style type='text/css'>
body {
font-family: monospace;
white-space: nowrap;
}
table {
border-collapse: collapse;
}
th,td {
border: 1px solid #eee;
padding: 10px;
vertical-align:top;
}
th:nth-child(1),th:nth-child(2) {
text-align: left;
}
th:nth-child(3),td:nth-child(3) {
text-align: center;
}
th:nth-child(4),td:nth-child(4) {
text-align: right;
}
</style>
</head>
<body>
<?php
require("OpenLDBWS.php");
$OpenLDBWS = new OpenLDBWS("YOUR_ACCESS_TOKEN");
$response = $OpenLDBWS->GetDepBoardWithDetails(10,"GTW");
$template["header"] = "
<table>
<thead>
<tr>
<th>Time</th>
<th>Destination</th>
<th>Platform</th>
<th>Expected</th>
</tr>
</thead>
<tbody>
";
$template["row"] = "
<tr>
<td>{std}</td>
<td><strong>{destination}</strong>{detail}</td>
<td>{platform}</td>
<td>{etd}</td>
</tr>
";
$template["footer"] = "
</tbody>
</table>
";
if (isset($response->GetStationBoardResult))
{
print "<p><strong>".$response->GetStationBoardResult->locationName."</strong> Departures</p>";
if (isset($response->GetStationBoardResult->nrccMessages))
{
print "<ul>";
foreach($response->GetStationBoardResult->nrccMessages->message as $message)
{
print "<li>".$message->{"_"}."</li>";
}
print "</ul>";
}
if (isset($response->GetStationBoardResult->trainServices->service))
{
print $template["header"];
foreach($response->GetStationBoardResult->trainServices->service as $service)
{
$row = $template["row"];
$destinations = array();
foreach($service->destination->location as $location)
{
$destinations[] = $location->locationName;
}
$row = str_replace("{std}",$service->std,$row);
$row = str_replace("{destination}",implode(" and ",$destinations),$row);
$row = str_replace("{platform}",(isset($service->platform)?$service->platform:" "),$row);
$row = str_replace("{etd}",$service->etd,$row);
$detail = "";
if (($service->etd != "Cancelled") && isset($service->subsequentCallingPoints))
{
foreach($service->subsequentCallingPoints->callingPointList as $k => $callingPointList)
{
$callingPoints = $callingPointList->callingPoint;
if ($k)
{
$callingPoint = array_shift($callingPoints);
$detail .= "<p>Train divides at <strong>".$callingPoint->locationName."</strong></p>";
}
$detail .= "<p>CALLING AT:</p>";
foreach($callingPoints as $callingPoint)
{
$detail .= $callingPoint->locationName." (".(($callingPoint->st == "On time")?$callingPoint->et:$callingPoint->st).")<br />";
}
}
$detail .= "<p>".$service->operator.(isset($service->length)?" (".$service->length." coaches)":"")."</p>";
}
$row = str_replace("{detail}",$detail,$row);
print $row;
}
print $template["footer"];
}
else
{
print "<p>No services within 2 hours.</p>";
}
}
?>
</body>
</html>
Gatwick Airport Departures
Time | Destination | Platform | Expected |
---|---|---|---|
01:45 | Bedford CALLING AT: Horley (01:48)Purley (02:03) East Croydon (02:10) London Blackfriars (02:36) London St Pancras (Intl) (02:43) Kentish Town (02:48) West Hampstead Thameslink (02:52) Cricklewood (02:55) Brent Cross West (02:58) Hendon (03:00) Mill Hill Broadway (03:03) Elstree & Borehamwood (03:07) Radlett (03:11) St Albans (03:17) Harpenden (03:24) Luton Airport Parkway (03:29) Luton (03:33) Leagrave (03:38) Harlington (03:43) Flitwick (03:47) Bedford (03:59) Thameslink |
1 | On time |
01:57 | Three Bridges CALLING AT: Three Bridges (02:02)Thameslink (12 coaches) |
2 | On time |
02:31 | Three Bridges CALLING AT: Three Bridges (02:36)Thameslink (12 coaches) |
2 | On time |
02:45 | Bedford CALLING AT: Horley (02:48)Purley (03:02) East Croydon (03:09) London Blackfriars (03:35) London St Pancras (Intl) (03:43) Kentish Town (03:48) West Hampstead Thameslink (03:52) Cricklewood (03:55) Brent Cross West (03:58) Hendon (04:00) Mill Hill Broadway (04:03) Elstree & Borehamwood (04:07) Radlett (04:11) St Albans (04:17) Harpenden (04:24) Luton Airport Parkway (04:29) Luton (04:33) Leagrave (04:38) Harlington (04:43) Flitwick (04:47) Bedford (04:59) Thameslink |
1 | On time |