public function request($method, $url, $data = null, $headers = [])
    {
        $request = $this->prepareRequest(new Request(), $method, $url, $data, $headers);

        return $this->send($request);
    }
public function request($method, $url, $data = null, $headers = [])
    {
        $request = $this->prepareRequest(new Request(), $method, $url, $data, $headers);

        return $this->send($request);
    }
public function request ( $ method , $ url , $ data = null , $ headers = [ ] ) { $ request = $ this -> prepareRequest ( new Request ( ) , $ method , $ url , $ data , $ headers ) ; return $ this -> send ( $ request ) ; }
Request a remote server.

This method will build a Request object and use send() method to send request.

@param string        $method  The method type.
@param string|object $url     The URL to request, may be string or Uri object.
@param mixed         $data    The request body data, can be an array of POST data.
@param array         $headers The headers array.

@return  ResponseInterface
Request a remote server .