44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
header('Access-Control-Allow-Origin: *');
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'GET' && $_SERVER['REQUEST_METHOD'] !== 'HEAD') {
|
|
header('Status: 405');
|
|
header('Content-Length: 0');
|
|
header('Allow: GET, HEAD');
|
|
exit;
|
|
}
|
|
|
|
$info = $_SERVER['PATH_INFO'];
|
|
if ($info !== '') {
|
|
header('Status: 404');
|
|
header('Content-Length: 0');
|
|
exit;
|
|
}
|
|
|
|
$query = [];
|
|
if (isset($_GET['country'])) {
|
|
$query[] = 'country=' . [
|
|
'AT' => '1',
|
|
'DE' => '2',
|
|
][$_GET['country']] ?? '';
|
|
}
|
|
if (isset($_GET['postalCode'])) {
|
|
$query[] = 'zipcode=' . urlencode($_GET['postalCode']);
|
|
}
|
|
if (isset($_GET['name'])) {
|
|
$query[] = 'aname=' . urlencode($_GET['name']);
|
|
}
|
|
if (isset($_GET['idNr'])) {
|
|
$query[] = 'clientcode=' . urlencode($_GET['idNr']);
|
|
}
|
|
if (isset($_GET['lfbisNr'])) {
|
|
$query[] = 'lfbis=' . urlencode($_GET['lfbisNr']);
|
|
}
|
|
|
|
header('Content-Type: application/json; charset=UTF-8');
|
|
|
|
echo "{\"data\":";
|
|
passthru("python3 .operators.py " . escapeshellarg(implode('&', $query)));
|
|
echo "}\n";
|