'a1e51f85-27b5-a1e3-65f7-561569884d38', 'DE' => '1be4d468-ba47-08f1-f048-f45869af856f', ][$_GET['country'] ?? null] ?? null; $postalCode = $_GET['postalCode'] ?? null; $name = $_GET['name'] ?? null; $idNr = $_GET['idNr'] ?? null; if ($country === null) { header('Status: 400'); header('Content-Length: 0'); exit; } $data = []; $url = "https://www.bioc.info/search/producerSearchQuery?search[name]=" . urlencode($name) . "&search[citycode]=" . urlencode($postalCode) . "&search[operatorId]=" . urlencode($idNr) . "&search[country]=$country"; if ($_GET['allDBs'] === 'true') { $s = curl_init($url . implode('&sources[]=', $source_groups[0])); curl_setopt($s, CURLOPT_RETURNTRANSFER, true); if (($json = curl_exec($s)) === false) { header('Status: 500'); header('Content-Length: 0'); exit; } $res = json_decode($json, true)['results']; foreach ($res as $r) { $data[$r['id']] = $r['row']; } } $s = curl_init($url . implode('&sources[]=', $source_groups[1])); curl_setopt($s, CURLOPT_RETURNTRANSFER, true); if (($json = curl_exec($s)) === false) { header('Status: 500'); header('Content-Length: 0'); exit; } $res = json_decode($json, true)['results']; foreach ($res as $r) { $data[$r['id']] = $r['row']; } header('Content-Type: application/json; charset=UTF-8'); $first = true; echo "{\"data\":[\n"; foreach ($data as $id => $row) { if (!$first) echo ",\n"; $row = explode("') + 1), 2); echo " "; echo jenc([ 'id' => $id, 'name' => substr($row[0], strrpos($row[0], '>') + 1), 'postalCode' => substr($row[1], strrpos($row[1], '>') + 1), 'city' => substr($row[2], strrpos($row[2], '>') + 1), 'authorityCode' => $auth[0], 'authorityName' => $auth[1], ]); $first = false; } echo "\n]}\n";