36534-vm/api/live_station_handler.php
2025-12-01 12:08:52 +00:00

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);
?>