<!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 |
---|---|---|---|
07:31 | Brighton CALLING AT: Haywards Heath (07:41)Brighton (07:57) Gatwick Express (8 coaches) |
6 | On time |
07:32 | London Victoria CALLING AT: East Croydon (07:48)Clapham Junction (07:58) London Victoria (08:06) Southern (8 coaches) |
5 | On time |
07:35 | Brighton CALLING AT: Three Bridges (07:39)Balcombe (07:46) Haywards Heath (07:51) Wivelsfield (07:56) Burgess Hill (07:58) Hassocks (08:02) Preston Park (08:08) Brighton (08:13) Thameslink (12 coaches) |
7 | On time |
07:36 | Bedford CALLING AT: East Croydon (07:51)London Bridge (08:05) London Blackfriars (08:11) City Thameslink (08:13) Farringdon (08:16) London St Pancras (Intl) (08:20) Luton Airport Parkway (08:45) Luton (08:49) Leagrave (08:53) Bedford (09:10) Thameslink (12 coaches) |
4 | On time |
07:40 | London Victoria CALLING AT: London Victoria (08:11)Gatwick Express (8 coaches) |
5 | On time |
07:41 | Bognor Regis CALLING AT: Three Bridges (07:45)Crawley (07:50) Horsham (07:59) Christs Hospital (08:09) Billingshurst (08:15) Pulborough (08:22) Amberley (08:28) Arundel (08:32) Ford (08:39) Barnham (08:43) Bognor Regis (08:51) Southern (4 coaches) |
On time | |
07:43 | London Victoria CALLING AT: East Croydon (07:58)Clapham Junction (08:07) London Victoria (08:15) Southern (12 coaches) |
2 | On time |
07:45 | Brighton CALLING AT: Three Bridges (07:49)Haywards Heath (07:59) Burgess Hill (08:05) Brighton (08:18) Thameslink (12 coaches) |
7 | On time |
07:46 | Cambridge CALLING AT: East Croydon (08:01)London Bridge (08:15) London Blackfriars (08:21) City Thameslink (08:23) Farringdon (08:26) London St Pancras (Intl) (08:30) Finsbury Park (08:37) Stevenage (09:01) Hitchin (09:07) Letchworth Garden City (09:12) Baldock (09:16) Ashwell & Morden (09:21) Royston (09:25) Cambridge (09:41) Thameslink (12 coaches) |
4 | On time |
07:49 | Peterborough CALLING AT: Horley (07:51)Redhill (07:59) Merstham (08:03) Coulsdon South (08:08) East Croydon (08:15) London Bridge (08:30) London Blackfriars (08:36) City Thameslink (08:38) Farringdon (08:41) London St Pancras (Intl) (08:45) Finsbury Park (08:52) Stevenage (09:13) Hitchin (09:20) Arlesey (09:26) Biggleswade (09:31) Sandy (09:35) St Neots (09:42) Huntingdon (09:50) Peterborough (10:07) Thameslink (12 coaches) |
2 | On time |