18 lines
389 B
PHP
18 lines
389 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
require_once 'rail_api.php';
|
|
|
|
$from = $_GET['from'] ?? null;
|
|
$to = $_GET['to'] ?? null;
|
|
$date = $_GET['date'] ?? null;
|
|
|
|
if (!$from || !$to || !$date) {
|
|
echo json_encode(['error' => 'From, To, and Date are required.']);
|
|
exit;
|
|
}
|
|
|
|
$api = new RailApi();
|
|
$response = $api->searchTrains($from, $to, $date);
|
|
|
|
echo json_encode($response);
|
|
?>
|