"2.0", "method" => $method, "params" => $params, "id" => $jsonrpc_id ]; $body = json_encode($data); curl_setopt($curl_session, CURLOPT_URL, $url); curl_setopt($curl_session, CURLOPT_POST, 1); curl_setopt($curl_session, CURLOPT_POSTFIELDS, $body); curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_session, CURLOPT_HEADER, false); curl_setopt($curl_session, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]); $response = curl_exec($curl_session); curl_close($curl_session); $response_object = json_decode($response, true); if(isset($response["error"])){ error_log(print_r($response, true)); throw new Exception($response["error"]["message"]); } return $response_object; }