<!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 |
|---|---|---|---|
| 10:05 | Three Bridges | Cancelled | |
| 10:15 | Brighton CALLING AT: Three Bridges (10:19)Haywards Heath (10:29) Burgess Hill (10:35) Brighton (10:48) Thameslink (12 coaches) |
7 | 10:35 |
| 10:22 | Littlehampton CALLING AT: Haywards Heath (10:32)Burgess Hill (10:39) Hassocks (10:43) Preston Park (10:50) Hove (10:53) Portslade (10:57) Shoreham-by-Sea (11:01) Lancing (11:06) Worthing (11:10) West Worthing (11:12) Durrington-on-Sea (11:15) Goring-by-Sea (11:18) Angmering (11:22) Littlehampton (11:32) Southern (12 coaches) |
7 | On time |
| 10:26 | London Victoria CALLING AT: East Croydon (10:41)Clapham Junction (10:51) London Victoria (10:58) Southern (8 coaches) |
4 | On time |
| 10:26 | Ore CALLING AT: Haywards Heath (10:37)Wivelsfield (10:42) Plumpton (10:49) Lewes (10:56) Polegate (11:09) Eastbourne (11:17) Hampden Park (11:27) Pevensey & Westham (11:32) Normans Bay (11:37) Cooden Beach (11:42) Collington (11:45) Bexhill (11:48) St Leonards Warrior Square (11:55) Hastings (11:58) Ore (12:02) Southern (8 coaches) |
7 | 10:28 |
| 10:29 | Reading CALLING AT: Redhill (10:37)Reigate (10:44) Dorking Deepdene (10:52) Gomshall (11:00) Chilworth (11:07) Shalford (11:10) Guildford (11:15) North Camp (11:31) Blackwater (11:38) Wokingham (11:46) Reading (11:57) Great Western Railway |
2 | On time |
| 10:31 | Brighton CALLING AT: Haywards Heath (10:41)Brighton (10:57) Gatwick Express (8 coaches) |
7 | On time |
| 10:32 | Bedford CALLING AT: Horley (10:35)Salfords (10:39) Earlswood (Surrey) (10:42) Redhill (10:46) Purley (10:56) South Croydon (11:00) East Croydon (11:03) Norwood Junction (11:07) London Bridge (11:20) London Blackfriars (11:26) City Thameslink (11:28) Farringdon (11:31) London St Pancras (Intl) (11:35) St Albans (11:54) Harpenden (12:01) Luton Airport Parkway (12:06) Luton (12:10) Leagrave (12:15) Harlington (12:20) Flitwick (12:24) Bedford (12:36) Thameslink (12 coaches) |
1 | On time |
| 10:32 | London Victoria CALLING AT: East Croydon (10:48)Clapham Junction (10:58) London Victoria (11:06) Southern (8 coaches) |
5 | On time |
| 10:35 | Three Bridges CALLING AT: Three Bridges (10:40)Thameslink (12 coaches) |
3 | 10:37 |