modified PUT options
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
77808f84cf
commit
a92c445725
|
@ -28,13 +28,11 @@ class ApiController
|
|||
{
|
||||
$error = false;
|
||||
$curl = curl_init();
|
||||
|
||||
|
||||
try {
|
||||
match ($serverType) {
|
||||
'panel' => curl_setopt(handle: $curl, option: CURLOPT_URL, value: "https://$serverName/api/v2/" . $command),
|
||||
'nameserver' => curl_setopt(handle: $curl, option: CURLOPT_URL, value: "https://$serverName/api/" . $command)
|
||||
|
||||
|
||||
};
|
||||
} catch (UnhandledMatchError) {
|
||||
echo 'Unhandled match: ' . $serverType;
|
||||
|
@ -56,6 +54,10 @@ class ApiController
|
|||
curl_setopt(handle: $curl, option: CURLOPT_POST, value: true);
|
||||
curl_setopt(handle: $curl, option: CURLOPT_POSTFIELDS, value: $body);
|
||||
}
|
||||
if ($requestType == "PUT") {
|
||||
curl_setopt(handle: $curl, option: CURLOPT_CUSTOMREQUEST, value: 'PUT');
|
||||
curl_setopt(handle: $curl, option: CURLOPT_POSTFIELDS, value: json_encode(value: $body));
|
||||
}
|
||||
|
||||
curl_setopt(handle: $curl, option: CURLOPT_CUSTOMREQUEST, value: $requestType);
|
||||
|
||||
|
@ -75,6 +77,9 @@ class ApiController
|
|||
$result = $resultJSON;
|
||||
}
|
||||
break;
|
||||
case 400:
|
||||
$result = $resultJSON;
|
||||
break;
|
||||
case 401:
|
||||
$result = 'Missing or wrong API Key';
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue