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