87 lines
2.1 KiB
PHP
87 lines
2.1 KiB
PHP
<?php
|
|
|
|
// ?ajax=routes&id=
|
|
if (isset($_GET['ajax']) && $_GET['ajax']=='routes') {
|
|
$id = (int)$_GET['id'];
|
|
if ($id>0) {
|
|
$url = API_BASE_URL . "?ajax=routes&id=${id}";
|
|
$opts = array(
|
|
'http' => array(
|
|
'method' => "GET",
|
|
'header' => "Accept: application/json\r\n" .
|
|
"Authorization: Server-Token ${oauth2ServiceToken}\r\n"
|
|
)
|
|
);
|
|
$context = stream_context_create($opts);
|
|
$body = file_get_contents($url, false, $context);
|
|
echo $body;
|
|
} else {
|
|
echo "Invalid ID!";
|
|
}
|
|
exit();
|
|
}
|
|
// ?ajax=taxiquote&id=
|
|
if (isset($_GET['ajax']) && $_GET['ajax']=='taxiquote') {
|
|
$id = (int)$_GET['id'];
|
|
if ($id>0) {
|
|
$url = API_BASE_URL . "?ajax=taxiquote&id=${id}";
|
|
$opts = array(
|
|
'http' => array(
|
|
'method' => "GET",
|
|
'header' => "Accept: application/json\r\n" .
|
|
"Authorization: Server-Token ${oauth2ServiceToken}\r\n"
|
|
)
|
|
);
|
|
$context = stream_context_create($opts);
|
|
$body = file_get_contents($url, false, $context);
|
|
echo $body;
|
|
} else {
|
|
echo "Invalid ID!";
|
|
}
|
|
exit();
|
|
}
|
|
// ?ajax=taxi&id=
|
|
if (isset($_GET['ajax']) && $_GET['ajax']=='taxi') {
|
|
$id = (int)$_GET['id'];
|
|
if ($id>0) {
|
|
$url = API_BASE_URL . "?ajax=taxi&id=${id}";
|
|
$opts = array(
|
|
'http' => array(
|
|
'method' => "GET",
|
|
'header' => "Accept: application/json\r\n" .
|
|
"Authorization: Server-Token ${oauth2ServiceToken}\r\n"
|
|
)
|
|
);
|
|
$context = stream_context_create($opts);
|
|
$body = file_get_contents($url, false, $context);
|
|
echo $body;
|
|
} else {
|
|
echo "Invalid ID!";
|
|
}
|
|
exit();
|
|
}
|
|
// ?ajax=quote&id=&sid=
|
|
if (isset($_GET['ajax']) && $_GET['ajax']=='quote') {
|
|
$id = (int)$_GET['id'];
|
|
$sid = (int)$_GET['sid'];
|
|
if ($id>0 && $sid>0) {
|
|
$url = API_BASE_URL . "?ajax=quote&id=${id}&sid=${sid}";
|
|
$opts = array(
|
|
'http' => array(
|
|
'method' => "GET",
|
|
'header' => "Accept: application/json\r\n" .
|
|
"Authorization: Server-Token ${oauth2ServiceToken}\r\n"
|
|
)
|
|
);
|
|
$context = stream_context_create($opts);
|
|
$body = file_get_contents($url, false, $context);
|
|
echo $body;
|
|
} else {
|
|
echo "Invalid ID/SID!";
|
|
}
|
|
exit();
|
|
}
|
|
|
|
// vi:ts=2
|
|
|