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