From 9ede0608218479a665eb150e9e0cc149fd3a5ee2 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Mon, 25 Sep 2023 11:13:53 +0200 Subject: [PATCH] Sitze und Rechtsformen aus Zefix API --- api.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/api.php b/api.php index 3e16aa8..15ed3ce 100644 --- a/api.php +++ b/api.php @@ -29,17 +29,22 @@ $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; + $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 { - $sitze = array(); //TODO alle Sitze hinzufügen - $sitze[] = 27; + $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; @@ -48,11 +53,14 @@ if (isset($_POST['sitze']) && is_array($_POST['sitze']) && count($_POST['sitze'] foreach ($sitze as $sitz) { $data["legalSeatId"] = $sitz; $response = sendAPICompanySearchRequest($username, $password, $data); - -// echo $response; - +// foreach ($data as $key => $value) { +// echo "Key: " . $key . ", Value: " . $value . "
"; +// } +// +// echo "-----------------------------------"; } + echo $rechtsform; }