<!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 |
---|---|---|---|
04:58 | Brighton CALLING AT: Three Bridges (05:03)Haywards Heath (05:13) Hove (05:28) Brighton (05:41) Southern (8 coaches) |
7 | On time |
05:04 | London Victoria CALLING AT: Horley (05:07)Purley (05:23) East Croydon (05:30) Selhurst (05:33) Thornton Heath (05:36) Norbury (05:39) Streatham Common (05:41) Balham (05:46) Clapham Junction (05:51) Battersea Park (05:55) London Victoria (05:59) Southern (8 coaches) |
1 | On time |
05:50 | London Victoria CALLING AT: London Victoria (06:27)Gatwick Express (8 coaches) |
2 | On time |
05:51 | Brighton CALLING AT: Three Bridges (05:56)Haywards Heath (06:06) Hove (06:20) Brighton (06:30) Southern (8 coaches) |
7 | On time |
06:00 | London Bridge CALLING AT: Horley (06:02)Salfords (06:06) Earlswood (Surrey) (06:11) Redhill (06:15) Merstham (06:20) Coulsdon South (06:25) Purley (06:29) East Croydon (06:34) Norwood Junction (06:38) London Bridge (06:52) Thameslink (12 coaches) |
1 | On time |
06:12 | Reading CALLING AT: Redhill (06:18)Reigate (06:27) Dorking Deepdene (06:36) Guildford (06:55) Ash (07:05) North Camp (07:10) Farnborough North (07:14) Blackwater (07:18) Sandhurst (07:22) Crowthorne (07:26) Wokingham (07:32) Reading (07:41) Great Western Railway (3 coaches) |
1 | On time |
06:20 | London Victoria CALLING AT: London Victoria (06:58)Gatwick Express (8 coaches) |
2 | On time |
06:22 | London Bridge CALLING AT: East Croydon (06:41)London Bridge (06:57) Thameslink |
1 | On time |
06:28 | London Victoria CALLING AT: Redhill (06:37)East Croydon (06:52) Selhurst (06:55) Clapham Junction (07:05) London Victoria (07:15) Southern (8 coaches) |
2 | On time |
06:33 | Brighton CALLING AT: Three Bridges (06:37)Haywards Heath (06:47) Wivelsfield (06:52) Burgess Hill (06:54) Hassocks (06:58) Preston Park (07:05) Brighton (07:12) Southern (8 coaches) |
7 | On time |