Please note: Rail Delivery Group plans to retire the National Rail Data Portal (including OpenLDBWS) in early 2026. Alternatives are now available via the Rail Data Marketplace
<!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 |
|---|---|---|---|
| 03:31 | Three Bridges CALLING AT: Three Bridges (03:36)Thameslink |
2 | On time |
| 03:45 | Bedford CALLING AT: Horley (03:48)Purley (04:02) East Croydon (04:10) London Blackfriars (04:35) London St Pancras (Intl) (04:43) Kentish Town (04:48) West Hampstead Thameslink (04:52) Cricklewood (04:55) Brent Cross West (04:58) Hendon (05:00) Mill Hill Broadway (05:03) Elstree & Borehamwood (05:07) Radlett (05:11) St Albans (05:17) Harpenden (05:24) Luton Airport Parkway (05:29) Luton (05:33) Leagrave (05:38) Harlington (05:43) Flitwick (05:47) Bedford (06:01) Thameslink |
1 | On time |
| 04:19 | Bedford CALLING AT: Purley (04:34)East Croydon (04:40) London Blackfriars (05:05) City Thameslink (05:08) Farringdon (05:10) London St Pancras (Intl) (05:15) West Hampstead Thameslink (05:24) Brent Cross West (05:27) St Albans (05:41) Harpenden (05:48) Luton Airport Parkway (05:53) Luton (05:57) Leagrave (06:01) Harlington (06:06) Flitwick (06:10) Bedford (06:24) Thameslink |
1 | On time |
| 04:31 | Three Bridges CALLING AT: Three Bridges (04:36)Thameslink |
2 | On time |
| 04:43 | Bedford CALLING AT: Horley (04:45)Salfords (04:50) Earlswood (Surrey) (04:54) Redhill (04:59) Purley (05:09) East Croydon (05:14) Norwood Junction (05:18) London Bridge (05:30) London Blackfriars (05:36) City Thameslink (05:38) Farringdon (05:41) London St Pancras (Intl) (05:45) West Hampstead Thameslink (05:54) St Albans (06:06) Harpenden (06:13) Luton Airport Parkway (06:18) Luton (06:22) Leagrave (06:27) Harlington (06:32) Flitwick (06:36) Bedford (06:50) Thameslink |
1 | On time |
| 04:58 | Brighton CALLING AT: Three Bridges (05:03)Haywards Heath (05:13) Brighton (05:32) Thameslink |
2 | On time |
| 05:11 | Reading CALLING AT: Redhill (05:20)Reigate (05:34) Dorking Deepdene (05:42) Shalford (05:56) Guildford (06:01) Wanborough (06:10) Ash (06:14) North Camp (06:19) Farnborough North (06:23) Blackwater (06:28) Sandhurst (06:32) Crowthorne (06:36) Wokingham (06:42) Reading (06:53) Great Western Railway |
1 | On time |