<!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 |
|---|---|---|---|
| 18:01 | Brighton | Cancelled | |
| 18:02 | Bedford CALLING AT: Horley (18:05)Salfords (18:09) Earlswood (Surrey) (18:12) Redhill (18:16) Purley (18:26) South Croydon (18:30) East Croydon (18:33) Norwood Junction (18:37) London Bridge (18:50) London Blackfriars (18:56) City Thameslink (18:58) Farringdon (19:01) London St Pancras (Intl) (19:05) St Albans (19:24) Harpenden (19:31) Luton Airport Parkway (19:36) Luton (19:40) Leagrave (19:45) Harlington (19:50) Flitwick (19:54) Bedford (20:07) Thameslink (8 coaches) |
1 | 18:10 |
| 18:02 | London Victoria CALLING AT: East Croydon (18:18)Clapham Junction (18:28) London Victoria (18:36) Southern (8 coaches) |
5 | 18:06 |
| 18:05 | Brighton CALLING AT: Three Bridges (18:09)Balcombe (18:16) Haywards Heath (18:21) Wivelsfield (18:26) Burgess Hill (18:28) Hassocks (18:32) Preston Park (18:38) Brighton (18:43) Thameslink (12 coaches) |
7 | On time |
| 18:05 | Three Bridges | Cancelled | |
| 18:06 | Bedford CALLING AT: East Croydon (18:21)London Bridge (18:35) London Blackfriars (18:41) City Thameslink (18:43) Farringdon (18:46) London St Pancras (Intl) (18:50) West Hampstead Thameslink (18:59) St Albans (19:11) Harpenden (19:17) Luton Airport Parkway (19:22) Luton (19:26) Leagrave (19:31) Harlington (19:36) Flitwick (19:40) Bedford (19:52) Thameslink (8 coaches) |
4 | 18:09 |
| 18:09 | Portsmouth Harbour and Bognor Regis CALLING AT: Three Bridges (18:14)Crawley (18:18) Horsham (18:27) Barnham (18:59) Chichester (19:07) Southbourne (19:15) Emsworth (19:18) Havant (19:24) Hilsea (19:31) Fratton (19:35) Portsmouth & Southsea (19:38) Portsmouth Harbour (19:48) Train divides at Horsham CALLING AT: Christs Hospital (18:39)Billingshurst (18:45) Pulborough (18:52) Amberley (18:58) Arundel (19:02) Ford (19:08) Barnham (19:13) Bognor Regis (19:21) Southern (12 coaches) |
6 | On time |
| 18:10 | London Victoria CALLING AT: London Victoria (18:42)Gatwick Express (8 coaches) |
5 | 18:28 |
| 18:13 | London Victoria CALLING AT: East Croydon (18:28)Clapham Junction (18:37) London Victoria (18:45) Southern (8 coaches) |
4 | On time |
| 18:15 | Brighton | Cancelled |