I have some problems with Guzzle and the REST API of my openHAB-system.
I have a fresh Laravel 7 installation, where I use Guzzle to retrieve Things from the openHAB API. This works fine for a GET-request to the /things
endpoint. However, when I try to send a request to a specific Things-endpoint /things/UUID
I get the following error:
GuzzleHttp\Exception\RequestException
cURL error 61: Unrecognized content encoding type. libcurl understands deflate, gzip content encodings. (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
I am not sure what this exactly means. Attached is a dump of the Guzzle Request Response in debug-mode:
Instantiate Guzzle Client in PHP-code:
$this->guzzle_client = new \GuzzleHttp\Client([
'base_uri' => $protocol.$this->server_hostname.':'.$this->server_port.'/rest/',
'verify' => false,
'auth' => [$this->server_username, $this->server_password],
'debug' => true,
]);
Debug-output from Guzzle Client:
* Trying 10.0.0.63...
* TCP_NODELAY set
* Connected to 10.0.0.63 (10.0.0.63) port 8080 (#0)
> GET /rest/things HTTP/1.1
Host: 10.0.0.63:8080
User-Agent: GuzzleHttp/6.5.5 curl/7.64.1 PHP/7.3.11
Authorization: Basic Og==
So far so good... Now comes the problem:
Guzzle Request that triggers the error:
$response = $this->api()->request('GET', 'things/'.$uid);
Debug-output from Guzzle Request:
* Found bundle for host 10.0.0.63: 0x7fafc9d7acb0 [can pipeline]
* Re-using existing connection! (#0) with host 10.0.0.63
* Connected to 10.0.0.63 (10.0.0.63) port 8080 (#0)
> GET /rest/things/zwave%3Adevice%3A23daaff0%3Anode7 HTTP/1.1
Host: 10.0.0.63:8080
User-Agent: GuzzleHttp/6.5.5 curl/7.64.1 PHP/7.3.11
Authorization: Basic Og==
< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Encoding: UTF-8
< Content-Length: 7386
< Server: Jetty(9.4.20.v20190813)
<
* Unrecognized content encoding type. libcurl understands deflate, gzip content encodings.
* Closing connection 0
I am not sure what to do here? It would seem like a trivial thing for Guzzle to fetch something from the openHAB API, so I do not understand why an encoding issue between these two systems would occur.
Any idea how to resolve this problem?