adding more Info about Company

This commit is contained in:
schrom01
2023-09-26 14:25:43 +02:00
parent b5c26c48bf
commit 1ea18c23f8
2 changed files with 36 additions and 4 deletions
+31
View File
@@ -3,6 +3,37 @@ include 'env_vars.php';
$username = getenv("username");
$password = getenv("password");
function sendAPICompanyInfoRequest(string $username, string $password, string $uid): string|bool {
// API endpoint
$apiUrl = 'https://www.zefix.admin.ch/ZefixPublicREST/api/v1/company/uid/'.$uid;
// Headers
$headers = array(
"accept: application/json",
"Content-Type: application/json"
);
// Initialize cURL session
$ch = curl_init();
// Set cURL options
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disable SSL verification
// Execute cURL session and get the response
$response = curl_exec($ch);
// Check for cURL errors
if (curl_errno($ch)) {
echo 'Curl error: ' . curl_error($ch);
}
// Close cURL session
curl_close($ch);
return $response;
}
/**
* @param string $