17 lines
363 B
PHP
17 lines
363 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
require_once 'rail_api.php';
|
|
|
|
$stationCode = $_GET['station_code'] ?? null;
|
|
$hours = $_GET['hours'] ?? 2;
|
|
|
|
if (!$stationCode) {
|
|
echo json_encode(['error' => 'Station code is required.']);
|
|
exit;
|
|
}
|
|
|
|
$api = new RailApi();
|
|
$response = $api->getLiveStation($stationCode, $hours);
|
|
|
|
echo json_encode($response);
|
|
?>
|