<!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 |
|---|---|---|---|
| 09:43 | London Victoria CALLING AT: East Croydon (09:58)Clapham Junction (10:07) London Victoria (10:15) Southern (8 coaches) |
2 | 10:00 |
| 09:56 | Eastbourne CALLING AT: Haywards Heath (10:07)Wivelsfield (10:12) Cooksbridge (10:21) Lewes (10:26) Polegate (10:39) Hampden Park (10:47) Eastbourne (10:51) Southern (8 coaches) |
7 | 10:00 |
| 09:56 | London Victoria CALLING AT: East Croydon (10:11)Clapham Junction (10:21) London Victoria (10:29) Southern (8 coaches) |
4 | 10:04 |
| 09:59 | Reading CALLING AT: Redhill (10:07)Reigate (10:14) Dorking Deepdene (10:22) Guildford (10:42) Ash (10:52) North Camp (10:56) Farnborough North (11:00) Blackwater (11:04) Sandhurst (11:08) Crowthorne (11:12) Wokingham (11:17) Reading (11:27) Great Western Railway |
1 | 10:02 |
| 10:01 | Brighton CALLING AT: Haywards Heath (10:11)Brighton (10:27) Gatwick Express (8 coaches) |
6 | On time |
| 10:02 | Bedford CALLING AT: Horley (10:05)Salfords (10:09) Earlswood (Surrey) (10:12) Redhill (10:16) Purley (10:26) South Croydon (10:30) East Croydon (10:33) Norwood Junction (10:37) London Bridge (10:50) London Blackfriars (10:56) City Thameslink (10:58) Farringdon (11:01) London St Pancras (Intl) (11:05) St Albans (11:24) Harpenden (11:31) Luton Airport Parkway (11:36) Luton (11:40) Leagrave (11:45) Harlington (11:50) Flitwick (11:54) Bedford (12:06) Thameslink (12 coaches) |
1 | 10:04 |
| 10:02 | London Victoria CALLING AT: East Croydon (10:18)Clapham Junction (10:30) London Victoria (10:37) Southern (8 coaches) |
5 | On time |
| 10:05 | Brighton CALLING AT: Three Bridges (10:09)Balcombe (10:16) Haywards Heath (10:21) Wivelsfield (10:26) Burgess Hill (10:28) Hassocks (10:32) Preston Park (10:38) Brighton (10:43) Thameslink (12 coaches) |
7 | On time |
| 10:05 | Three Bridges CALLING AT: Three Bridges (10:10)Thameslink (12 coaches) |
3 | 10:11 |
| 10:06 | Bedford CALLING AT: East Croydon (10:21)London Bridge (10:35) London Blackfriars (10:41) City Thameslink (10:43) Farringdon (10:46) London St Pancras (Intl) (10:50) West Hampstead Thameslink (10:59) St Albans (11:11) Harpenden (11:17) Luton Airport Parkway (11:22) Luton (11:26) Leagrave (11:31) Harlington (11:36) Flitwick (11:40) Bedford (11:52) Thameslink (12 coaches) |
4 | 10:09 |