sailthru/Sailthru_Client.php
protected function httpRequest($action, $data, $method = 'POST', $options = [ ]) {
        $response = $this->{$this->http_request_type}($action, $data, $method, $options);
        $json = json_decode($response, true);
        if ($json === NULL) {
            throw new Sailthru_Client_Exception(
                "Response: {$response} is not a valid JSON",
                Sailthru_Client_Exception::CODE_RESPONSE_INVALID
            );
        }
        if (!empty($json['error'])) {
            throw new Sailthru_Client_Exception($json['errormsg'], $json['error']);
        }

        return $json;
    }
protected function httpRequest($action, $data, $method = 'POST', $options = [ ]) {
        $response = $this->{$this->http_request_type}($action, $data, $method, $options);
        $json = json_decode($response, true);
        if ($json === NULL) {
            throw new Sailthru_Client_Exception(
                "Response: {$response} is not a valid JSON",
                Sailthru_Client_Exception::CODE_RESPONSE_INVALID
            );
        }
        if (!empty($json['error'])) {
            throw new Sailthru_Client_Exception($json['errormsg'], $json['error']);
        }

        return $json;
    }
protected function httpRequest ( $ action , $ data , $ method = 'POST' , $ options = [ ] ) { $ response = $ this -> { $ this -> http_request_type } ( $ action , $ data , $ method , $ options ) ; $ json = json_decode ( $ response , true ) ; if ( $ json === NULL ) { throw new Sailthru_Client_Exception ( "Response: {$response} is not a valid JSON" , Sailthru_Client_Exception :: CODE_RESPONSE_INVALID ) ; } if ( ! empty ( $ json [ 'error' ] ) ) { throw new Sailthru_Client_Exception ( $ json [ 'errormsg' ] , $ json [ 'error' ] ) ; } return $ json ; }
Perform an HTTP request, checking for curl extension support

@param $action
@param array $data
@param string $method
@param array $options
@return string
@throws Sailthru_Client_Exception
Perform an HTTP request checking for curl extension support