adding more Info about Company
This commit is contained in:
@@ -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 $
|
||||
|
||||
Reference in New Issue
Block a user