Zefix_search/api.php

76 lines
1.9 KiB
PHP

<?php
include 'zefixAPI.php';
/*
* Request Types:
* Count
* List
* Export
*/
// Request data
$data = array();
$results = array();
// Wenn Firmenname vorhanden
if(isset($_POST['firma']) && !empty($_POST['firma'])) {
$data["name"] = $_POST['firma'];
}
// Wenn gelöschte auch gesucht werden sollen
if(isset($_POST['geloeschteRechtseinheiten'])) {
$data["activeOnly"] = false;
} else {
$data["activeOnly"] = true;
}
$rechtsformen = array();
if (isset($_POST['rechtsform']) && is_array($_POST['rechtsform']) && count($_POST['rechtsform']) > 0) {
$rechtsformen = $_POST['rechtsform'];
} else {
$legalFormArray = json_decode(sendAPILegalFormRequest($username, $password), true);
foreach ($legalFormArray as $rechtsform) {
$rechtsformen[] = $rechtsform["id"];
}
}
$sitze = array();
if (isset($_POST['sitze']) && is_array($_POST['sitze']) && count($_POST['sitze']) > 0) {
$sitze = $_POST['sitze'];
} else {
$communityArray = json_decode(sendAPICommunityRequest($username, $password), true);
foreach ($communityArray as $community) {
$sitze[] = $community["bfsId"];
}
}
phpinfo();
// Loop through the selected values
foreach ($rechtsformen as $rechtsform) {
$data["legalFormId"] = $rechtsform;
// Loop through the selected values
foreach ($sitze as $sitz) {
$data["legalSeatId"] = $sitz;
$response = sendAPICompanySearchRequest($username, $password, $data);
// foreach ($data as $key => $value) {
// echo "Key: " . $key . ", Value: " . $value . "<br>";
// }
//
// echo "-----------------------------------";
}
echo $rechtsform;
}
// Process the Zefix response and construct your own response
// ...
$constructed_response = $response;
// Send the response back to the client
//header('Content-Type: application/json');
//echo $constructed_response;
?>