public function request($endpoint, $method, $data = [], $parameters = [])
    {
        // Initialize cURL.
        $this->ch = \curl_init();

        // Set request args.
        $request = $this->createRequest($endpoint, $method, $data, $parameters);

        // Default cURL settings.
        $this->setDefaultCurlSettings();

        // Get response.
        $response = $this->createResponse();

        // Check for cURL errors.
        if (\curl_errno($this->ch)) {
            throw new HttpClientException('cURL Error: ' . \curl_error($this->ch), 0, $request, $response);
        }

        \curl_close($this->ch);

        return $this->processResponse();
    }
public function request($endpoint, $method, $data = [], $parameters = [])
    {
        // Initialize cURL.
        $this->ch = \curl_init();

        // Set request args.
        $request = $this->createRequest($endpoint, $method, $data, $parameters);

        // Default cURL settings.
        $this->setDefaultCurlSettings();

        // Get response.
        $response = $this->createResponse();

        // Check for cURL errors.
        if (\curl_errno($this->ch)) {
            throw new HttpClientException('cURL Error: ' . \curl_error($this->ch), 0, $request, $response);
        }

        \curl_close($this->ch);

        return $this->processResponse();
    }
public function request ( $ endpoint , $ method , $ data = [ ] , $ parameters = [ ] ) { // Initialize cURL. $ this -> ch = \ curl_init ( ) ; // Set request args. $ request = $ this -> createRequest ( $ endpoint , $ method , $ data , $ parameters ) ; // Default cURL settings. $ this -> setDefaultCurlSettings ( ) ; // Get response. $ response = $ this -> createResponse ( ) ; // Check for cURL errors. if ( \ curl_errno ( $ this -> ch ) ) { throw new HttpClientException ( 'cURL Error: ' . \ curl_error ( $ this -> ch ) , 0 , $ request , $ response ) ; } \ curl_close ( $ this -> ch ) ; return $ this -> processResponse ( ) ; }
Make requests.

@param string $endpoint   Request endpoint.
@param string $method     Request method.
@param array  $data       Request data.
@param array  $parameters Request parameters.

@return array
Make requests .