public function request($method, $url = '', $body = null, array $headers = [])
    {
        $url = $this->getAbsoluteUrl($url);

        $response = $this->send(new HTTP\Request($method, $url, $headers, $body));

        return [
            'body' => $response->getBodyAsString(),
            'statusCode' => (int) $response->getStatus(),
            'headers' => array_change_key_case($response->getHeaders()),
        ];
    }
public function request($method, $url = '', $body = null, array $headers = [])
    {
        $url = $this->getAbsoluteUrl($url);

        $response = $this->send(new HTTP\Request($method, $url, $headers, $body));

        return [
            'body' => $response->getBodyAsString(),
            'statusCode' => (int) $response->getStatus(),
            'headers' => array_change_key_case($response->getHeaders()),
        ];
    }
public function request ( $ method , $ url = '' , $ body = null , array $ headers = [ ] ) { $ url = $ this -> getAbsoluteUrl ( $ url ) ; $ response = $ this -> send ( new HTTP \ Request ( $ method , $ url , $ headers , $ body ) ) ; return [ 'body' => $ response -> getBodyAsString ( ) , 'statusCode' => ( int ) $ response -> getStatus ( ) , 'headers' => array_change_key_case ( $ response -> getHeaders ( ) ) , ] ; }
Performs an actual HTTP request, and returns the result.

If the specified url is relative, it will be expanded based on the base
url.

The returned array contains 3 keys:
* body - the response body
* httpCode - a HTTP code (200, 404, etc)
* headers - a list of response http headers. The header names have
been lowercased.

For large uploads, it's highly recommended to specify body as a stream
resource. You can easily do this by simply passing the result of
fopen(..., 'r').

This method will throw an exception if an HTTP error was received. Any
HTTP status code above 399 is considered an error.

Note that it is no longer recommended to use this method, use the send()
method instead.

@param string               $method
@param string               $url
@param string|resource|null $body
@param array                $headers

@throws clientException, in case a curl error occurred

@return array
Performs an actual HTTP request and returns the result .