Zefix_search/api/index.php

70 lines
1.5 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-21 20:41:55 +02:00
phpinfo();
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 {
$rechtsformen = array(); //TODO alle Rechtsformen hinzufügen
$rechtsformen[] = 2;
}
$sitze = array();
if (isset($_POST['sitze']) && is_array($_POST['sitze']) && count($_POST['sitze']) > 0) {
$sitze = $_POST['sitze'];
} else {
$sitze = array(); //TODO alle Sitze hinzufügen
$sitze[] = 27;
}
// 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-08-21 17:09:46 +02:00
2023-08-21 20:37:59 +02:00
echo $response;
2023-08-17 21:38:35 +02:00
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-17 21:38:35 +02:00
2023-08-17 19:08:24 +02:00
?>