Zefix_search/api.php

76 lines
1.9 KiB
PHP
Raw Normal View History

2023-08-17 19:08:24 +02:00
<?php
2023-08-21 20:37:59 +02:00
include 'zefixAPI.php';
2023-08-21 17:08:15 +02:00
2023-08-17 21:38:35 +02:00
2023-08-21 20:37:59 +02:00
/*
* Request Types:
* Count
* List
* Export
*/
2023-08-17 21:38:35 +02:00
// Request data
2023-08-21 20:37:59 +02:00
$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;
2023-08-17 21:38:35 +02:00
}
2023-08-21 20:37:59 +02:00
$rechtsformen = array();
if (isset($_POST['rechtsform']) && is_array($_POST['rechtsform']) && count($_POST['rechtsform']) > 0) {
$rechtsformen = $_POST['rechtsform'];
} else {
2023-09-25 11:13:53 +02:00
$legalFormArray = json_decode(sendAPILegalFormRequest($username, $password), true);
foreach ($legalFormArray as $rechtsform) {
$rechtsformen[] = $rechtsform["id"];
}
2023-08-21 20:37:59 +02:00
}
$sitze = array();
if (isset($_POST['sitze']) && is_array($_POST['sitze']) && count($_POST['sitze']) > 0) {
$sitze = $_POST['sitze'];
} else {
2023-09-25 11:13:53 +02:00
$communityArray = json_decode(sendAPICommunityRequest($username, $password), true);
foreach ($communityArray as $community) {
$sitze[] = $community["bfsId"];
}
2023-08-21 20:37:59 +02:00
}
2023-09-25 11:13:53 +02:00
phpinfo();
2023-08-21 20:37:59 +02:00
// Loop through the selected values
foreach ($rechtsformen as $rechtsform) {
$data["legalFormId"] = $rechtsform;
2023-08-17 21:38:35 +02:00
2023-08-21 20:37:59 +02:00
// Loop through the selected values
foreach ($sitze as $sitz) {
$data["legalSeatId"] = $sitz;
$response = sendAPICompanySearchRequest($username, $password, $data);
2023-09-25 11:13:53 +02:00
// foreach ($data as $key => $value) {
// echo "Key: " . $key . ", Value: " . $value . "<br>";
// }
//
// echo "-----------------------------------";
2023-08-17 21:38:35 +02:00
2023-08-21 20:37:59 +02:00
}
2023-09-25 11:13:53 +02:00
echo $rechtsform;
2023-08-21 20:37:59 +02:00
}
2023-08-17 21:38:35 +02:00
// Process the Zefix response and construct your own response
// ...
$constructed_response = $response;
// Send the response back to the client
2023-08-21 20:37:59 +02:00
//header('Content-Type: application/json');
//echo $constructed_response;
2023-08-21 21:16:49 +02:00
2023-08-17 19:08:24 +02:00
?>