<!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 |
---|---|---|---|
15:47 | Horsham CALLING AT: Three Bridges (15:52)Crawley (15:57) Ifield (16:00) Littlehaven (16:06) Horsham (16:10) Thameslink (12 coaches) |
3 | 15:53 |
15:49 | Peterborough CALLING AT: Horley (15:51)Salfords (15:54) Earlswood (Surrey) (15:55) Redhill (15:59) Merstham (16:03) Coulsdon South (16:08) East Croydon (16:15) London Bridge (16:30) London Blackfriars (16:36) City Thameslink (16:38) Farringdon (16:41) London St Pancras (Intl) (16:45) Finsbury Park (16:52) Stevenage (17:13) Hitchin (17:20) Arlesey (17:26) Biggleswade (17:31) Sandy (17:35) St Neots (17:42) Huntingdon (17:49) Peterborough (18:05) Thameslink (12 coaches) |
1 | 15:51 |
15:52 | Littlehampton CALLING AT: Three Bridges (15:55)Haywards Heath (16:02) Burgess Hill (16:09) Hassocks (16:13) Preston Park (16:20) Hove (16:23) Portslade (16:27) Shoreham-by-Sea (16:31) Lancing (16:36) Worthing (16:40) West Worthing (16:42) Durrington-on-Sea (16:45) Goring-by-Sea (16:48) Angmering (16:52) Littlehampton (17:02) Southern (8 coaches) |
6 | On time |
15:56 | Eastbourne CALLING AT: Haywards Heath (16:07)Wivelsfield (16:12) Cooksbridge (16:21) Lewes (16:26) Polegate (16:39) Hampden Park (16:47) Eastbourne (16:51) Southern (8 coaches) |
7 | On time |
15:56 | London Victoria CALLING AT: East Croydon (16:11)Clapham Junction (16:21) London Victoria (16:28) Southern (8 coaches) |
2 | On time |
15:59 | Reading CALLING AT: Redhill (16:07)Reigate (16:14) Dorking Deepdene (16:22) Guildford (16:42) Ash (16:52) North Camp (16:57) Farnborough North (17:01) Blackwater (17:06) Sandhurst (17:10) Crowthorne (17:14) Wokingham (17:19) Reading (17:29) Great Western Railway |
5 | On time |
16:01 | Brighton | Cancelled | |
16:02 | Bedford | Cancelled | |
16:02 | London Victoria CALLING AT: East Croydon (16:18)Clapham Junction (16:28) London Victoria (16:38) Southern (8 coaches) |
2 | On time |
16:05 | Three Bridges | Cancelled |