<!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 |
---|---|---|---|
21:24 | London Victoria CALLING AT: East Croydon (21:39)Clapham Junction (21:49) London Victoria (21:58) Southern (8 coaches) |
4 | 21:36 |
21:36 | Bedford CALLING AT: East Croydon (21:51)London Bridge (22:04) London Blackfriars (22:11) City Thameslink (22:13) Farringdon (22:16) London St Pancras (Intl) (22:20) West Hampstead Thameslink (22:29) St Albans (22:41) Harpenden (22:47) Luton Airport Parkway (22:52) Luton (22:56) Leagrave (23:01) Harlington (23:06) Flitwick (23:10) Bedford (23:21) Thameslink (12 coaches) |
1 | 21:44 |
21:39 | Portsmouth Harbour and Bognor Regis CALLING AT: Three Bridges (21:44)Crawley (21:48) Horsham (21:57) Barnham (22:33) Chichester (22:41) Southbourne (22:48) Emsworth (22:51) Havant (22:55) Fratton (23:04) Portsmouth & Southsea (23:07) Portsmouth Harbour (23:11) Train divides at Horsham CALLING AT: Christs Hospital (22:09)Billingshurst (22:15) Pulborough (22:21) Amberley (22:27) Arundel (22:32) Ford (22:38) Barnham (22:42) Bognor Regis (22:50) Southern (8 coaches) |
7 | On time |
21:39 | London Victoria CALLING AT: London Victoria (22:09)Gatwick Express (8 coaches) |
4 | 21:40 |
21:42 | London Victoria CALLING AT: East Croydon (21:56)Clapham Junction (22:07) London Victoria (22:14) Southern |
1 | On time |
21:44 | Brighton CALLING AT: Three Bridges (21:48)Balcombe (21:55) Haywards Heath (22:00) Burgess Hill (22:06) Brighton (22:17) Thameslink (12 coaches) |
7 | On time |
21:46 | Cambridge CALLING AT: East Croydon (22:01)London Bridge (22:15) London Blackfriars (22:21) City Thameslink (22:23) Farringdon (22:26) London St Pancras (Intl) (22:30) Finsbury Park (22:37) Stevenage (22:58) Hitchin (23:05) Letchworth Garden City (23:11) Baldock (23:15) Ashwell & Morden (23:20) Royston (23:24) Cambridge (23:40) Thameslink (12 coaches) |
4 | 21:49 |
21:47 | Horsham CALLING AT: Three Bridges (21:52)Crawley (21:56) Ifield (21:59) Littlehaven (22:05) Horsham (22:09) Thameslink (12 coaches) |
3 | On time |
21:49 | Peterborough CALLING AT: Horley (21:51)Redhill (21:59) Merstham (22:03) Coulsdon South (22:08) East Croydon (22:15) London Bridge (22:30) London Blackfriars (22:36) City Thameslink (22:38) Farringdon (22:41) London St Pancras (Intl) (22:45) Finsbury Park (22:52) Stevenage (23:14) Hitchin (23:20) Arlesey (23:25) Biggleswade (23:30) Sandy (23:34) St Neots (23:41) Huntingdon (23:49) Peterborough (00:07) Thameslink (12 coaches) |
1 | On time |
21:50 | Littlehampton CALLING AT: Three Bridges (21:53)Haywards Heath (22:02) Burgess Hill (22:09) Hassocks (22:12) Preston Park (22:19) Hove (22:23) Portslade (22:26) Shoreham-by-Sea (22:31) Worthing (22:37) West Worthing (22:42) Durrington-on-Sea (22:44) Goring-by-Sea (22:47) Angmering (22:51) Littlehampton (23:01) Southern (8 coaches) |
7 | On time |