[FIX] Proper response string for debug output
This commit is contained in:
parent
aa27e8dfde
commit
c42fc60742
@ -107,14 +107,15 @@ class jsonRPCClient {
|
|||||||
curl_setopt($ch, CURLOPT_USERPWD, $url['user'] . ":" . $url['pass']);
|
curl_setopt($ch, CURLOPT_USERPWD, $url['user'] . ":" . $url['pass']);
|
||||||
curl_setopt($ch, CURLOPT_POST, true);
|
curl_setopt($ch, CURLOPT_POST, true);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
|
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);
|
$resultStatus = curl_getinfo($ch);
|
||||||
if ($resultStatus['http_code'] != '200') {
|
if ($resultStatus['http_code'] != '200') {
|
||||||
if ($resultStatus['http_code'] == '401') throw new Exception('RPC call did not return 200: Authentication failed');
|
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']);
|
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 (curl_errno($ch)) throw new Exception('RPC call failed: ' . curl_error($ch));
|
||||||
if ($this->debug) $this->debug_output[] = 'Response: ' . $response;
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
// final checks and return
|
// final checks and return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user