Sitze und Rechtsformen aus Zefix API

This commit is contained in:
schrom01 2023-08-21 21:12:21 +02:00
parent f9701e936f
commit d294253a27
3 changed files with 5 additions and 7 deletions

View File

@ -50,7 +50,7 @@ if (isset($_POST['sitze']) && is_array($_POST['sitze']) && count($_POST['sitze']
$response = sendAPICompanySearchRequest($username, $password, $data);
// echo $response;
echo communityCSV($username, $password);
}
@ -64,6 +64,4 @@ $constructed_response = $response;
//header('Content-Type: application/json');
//echo $constructed_response;
?>

View File

@ -4,6 +4,7 @@ $username = getenv("username");
$password = getenv("password");
/**
* @param string $
* @param string $
@ -41,7 +42,6 @@ echo 'Curl error: ' . curl_error($ch);
}
// Close cURL session
curl_close($ch);
echo $response;
return $response;
}
@ -81,7 +81,6 @@ function sendAPICommunityRequest(string $username, string $password): string|boo
function communityCSV(string $username, string $password): string {
$response = sendAPICommunityRequest($username, $password);
echo $response;
$communityArray = json_decode($response, true);
$csvOutput = 'bfsId,Kanton,Gemeindename,registryOfCommerceId\n';
// Create CSV rows
@ -138,5 +137,4 @@ function legalFormCSV(string $username, string $password): string {
return $csvOutput;
}
sendAPICommunityRequest($username, $password);
?>

View File

@ -1,3 +1,6 @@
<?php
include "api/zefixAPI.php";
?>
<html lang="de">
<head>
<meta charset="UTF-8">
@ -144,7 +147,6 @@
let communityCsvData;
let legalFormsCsvData;
<?php
include 'api/zefixAPI.php';
include 'gemeinden.php';
include 'legalForms.php';
?>