|
|
|
@ -1,14 +1,17 @@
|
|
|
|
|
<?php
|
|
|
|
|
class WS_Util
|
|
|
|
|
{
|
|
|
|
|
public static function CallWebService(string $base_url,string $endpoint, string $method,array $queryParams = [], $requestBody = []) : array {
|
|
|
|
|
public static function CallWebService(string $base_url,string $endpoint, string $method,array $queryParams = [], $requestBody = [], string $login = "", string $pwd = "" ) : array {
|
|
|
|
|
$url = $base_url . $endpoint;
|
|
|
|
|
|
|
|
|
|
$options = [
|
|
|
|
|
'http' => [
|
|
|
|
|
'method' => $method,
|
|
|
|
|
'header' => 'Content-Type: application/json', // Remplacez si nécessaire
|
|
|
|
|
'ignore_errors' => true, // Gérer les erreurs HTTP
|
|
|
|
|
'header' => array(
|
|
|
|
|
'Content-Type: application/json',
|
|
|
|
|
empty($login)?:'Authorization: Basic $login $pwd'
|
|
|
|
|
),
|
|
|
|
|
'ignore_errors' => true
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|