diff --git a/README.md b/README.md index aa91569..e448cb5 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Recomended installation is using [Composer], if you do not have [Composer] what In the root of your project execute the following: ```sh -$ composer require lumaserv/proxmoxve ~4.0.2 +$ composer require lumaserv/proxmoxve ~4.0.3 ``` Or add this to your `composer.json` file: @@ -29,7 +29,7 @@ Or add this to your `composer.json` file: ```json { "require": { - "lumaserv/proxmoxve": "~4.0.2" + "lumaserv/proxmoxve": "~4.0.3" } } ``` diff --git a/composer.json b/composer.json index 09b3e3a..4b49e4e 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "keywords": ["Proxmox", "API", "KVM", "OpenVZ", "Virtualization"], "homepage": "https://github.com/LUMASERV/ProxmoxVE", "license": "MIT", - "version": "v4.0.2", + "version": "v4.0.3", "authors": [ { diff --git a/src/Proxmox.php b/src/Proxmox.php index a9792d1..fe304cc 100644 --- a/src/Proxmox.php +++ b/src/Proxmox.php @@ -10,6 +10,8 @@ namespace ProxmoxVE; use GuzzleHttp\Client; +use GuzzleHttp\Cookie\CookieJar; +use GuzzleHttp\Cookie\SetCookie; use ProxmoxVE\Exception\MalformedCredentialsException; use ProxmoxVE\Exception\AuthenticationException; use Psr\Http\Message\ResponseInterface; @@ -101,9 +103,13 @@ private function requestResource($actionPath, $params = [], $method = 'GET') { $url = $this->getApiUrl() . $actionPath; - $cookies = [ - 'PVEAuthCookie' => $this->authToken->getTicket(), - ]; + $jar = CookieJar::fromArray([ + 'PVEAuthCookie' => $this->authToken->getTicket() + ], null); + +// $cookies = [ +// 'PVEAuthCookie' => $this->authToken->getTicket(), +// ]; if ($method != 'GET') { $headers = [ @@ -117,7 +123,7 @@ private function requestResource($actionPath, $params = [], $method = 'GET') return $this->httpClient->get($url, [ 'verify' => false, 'exceptions' => false, - 'cookies' => $cookies, + 'cookies' => $jar, 'query' => $params, ]); break; @@ -125,7 +131,7 @@ private function requestResource($actionPath, $params = [], $method = 'GET') return $this->httpClient->post($url, [ 'verify' => false, 'exceptions' => false, - 'cookies' => $cookies, + 'cookies' => $jar, 'headers' => $headers, 'form_params' => $params, ]); @@ -134,7 +140,7 @@ private function requestResource($actionPath, $params = [], $method = 'GET') return $this->httpClient->put($url, [ 'verify' => false, 'exceptions' => false, - 'cookies' => $cookies, + 'cookies' => $jar, 'headers' => $headers, 'form_params' => $params, ]); @@ -143,7 +149,7 @@ private function requestResource($actionPath, $params = [], $method = 'GET') return $this->httpClient->delete($url, [ 'verify' => false, 'exceptions' => false, - 'cookies' => $cookies, + 'cookies' => $jar, 'headers' => $headers, 'form_params' => $params, ]);