diff --git a/public/include/lib/jsonRPCClient.php b/public/include/lib/jsonRPCClient.php index 5fcb72a2..81f61d70 100644 --- a/public/include/lib/jsonRPCClient.php +++ b/public/include/lib/jsonRPCClient.php @@ -107,14 +107,15 @@ class jsonRPCClient { curl_setopt($ch, CURLOPT_USERPWD, $url['user'] . ":" . $url['pass']); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); - $response = json_decode(curl_exec($ch), true); + $response = curl_exec($ch); + if ($this->debug) $this->debug_output[] = 'Response: ' . $response; + $response = json_decode($response, true); $resultStatus = curl_getinfo($ch); if ($resultStatus['http_code'] != '200') { if ($resultStatus['http_code'] == '401') throw new Exception('RPC call did not return 200: Authentication failed'); throw new Exception('RPC call did not return 200: HTTP error: ' . $resultStatus['http_code']); } if (curl_errno($ch)) throw new Exception('RPC call failed: ' . curl_error($ch)); - if ($this->debug) $this->debug_output[] = 'Response: ' . $response; curl_close($ch); // final checks and return