diff --git a/src/Controller/CheckController.php b/src/Controller/CheckController.php index 88ddbf3..06a475c 100644 --- a/src/Controller/CheckController.php +++ b/src/Controller/CheckController.php @@ -19,7 +19,7 @@ class CheckController * * @return array */ - function sendCommand(String $serverName, int $versionIP, String $apiKey, String $command, String $type): array + function sendCommand(String $serverName, int $versionIP, String $apiKey, String $command, String $type, bool $post = false, array $body = []): array { $curl = curl_init(); if ($type == "panel") { @@ -38,6 +38,10 @@ class CheckController curl_setopt(handle: $curl, option: CURLOPT_HTTPHEADER, value: ["X-API-Key:$apiKey"]); + if ($post) { + curl_setopt($curl, option: CURLOPT_POST, value: true); + curl_setopt($curl, option: CURLOPT_POSTFIELDS, value: $body); + } if ($resultJSON = curl_exec(handle: $curl)) { $httpResponse = curl_getinfo(handle: $curl)['http_code']; @@ -58,6 +62,7 @@ class CheckController $result = 'Missing or wrong API Key'; break; default: + echo __FILE__, __LINE__, $resultJSON; $result = 'Unhandled error: ' . $httpResponse; } } else {