This repository has been archived on 2023-08-24. You can view files and clone it, but cannot push or open issues or pull requests.
athena.fb-infra.uk/php/LDB-Tests/example_output_SV.php
2022-11-26 20:42:40 +00:00

65 lines
1.8 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<title>TESTING</title>
</head>
<body>
<?php
require './php/openLDBWS.php';
require './php/submitIssue.php';
require '/srv/keys/athena/apiKeys.php';
echo cleanInput($_SERVER['QUERY_STRING']);
date_default_timezone_set("Europe/London");
$OpenLDBWS = new OpenLDBWS($ldbKey);
$response = $OpenLDBWS->GetDepartureBoardByCRS(10,"BRI",date("H:i:s",time()),120,"","","","","True");
$template["header"] = "
<table>
<thead>
<tr>
<th>ID</th>
<th>Org.</th>
<th>Dest.</th>
<th>Plat.</th>
<th>Sch</th>
<th>Exp</th>
</tr>
</thead>
<tbody>
";
$template["row"] = "
<tr>
<td>{id}</td>
<td>{org}</td>
<td>{dest}</td>
<td>{plat}</td>
<td>{sch}</td>
<td>{act}</td>
</tr>
";
$template["footer"] = "
</tbody>
</table>
";
if (isset($response->GetBoardResult->trainServices->service))
{
print $template["header"];
foreach($response->GetBoardResult->trainServices->service as $service)
{
$row = $template["row"];
$destinations = array();
$row = str_replace("{id}",$service->trainid,$row);
$row = str_replace("{org}",$service->origin->location->tiploc,$row);
$row = str_replace("{dest}",$service->destination->location->tiploc,$row);
$row = str_replace("{plat}",$service->platform,$row);
$row = str_replace("{sch}",$servoce->std,$row);
$row = str_replace("{act}",$service->etd,$row);
print $row;
}
print $template["footer"];
}
?>
</body>
</html>