@param string $url
@param string $method

@return bool|mixed|\Psr\Http\Message\ResponseInterface
@throws \GuzzleHttp\Exception\GuzzleException
338033
public function makeRequest($url, $method = 'GET')
    {
        try {
            [$url, $parameters] = $this->getRequestUrlAndParameters($url, $method === 'GET');
            return $this->response = $this->client->request($method, $url, $parameters);
        } catch (RequestException $e) {
            $this->printErrorMessage(Psr7\str($e->getRequest()), false);
            if ($e->hasResponse()) {
                $this->response = $e->getResponse();
                $this->printErrorMessage(Psr7\str($e->getResponse()), false);
            }
        }
        return false;
    }
747324
private function getUrl($method)
    {
        return sprintf(
            $this::API_URL,
            $this->getDc(),
            $this->getApiVersion(),
            $method
        );
    }
1093601
public static function create($method, $url = null)
    {
        return new static(new Method($method), null === $url ? null : new Url($url));
    }
977846
public function matches($uri, $method)
    {
        // Check if request method matches.
        if (in_array($method, $this->methods)) {
            $paramValues = [];

            // Replace parameters with proper regex patterns.
            $urlRegex = preg_replace_callback(self::MATCHES_REGEX, [$this, 'regexUrl'], $this->url);

            // Check if URI matches and if it matches put results in values array.
            $pattern = '@^' . $urlRegex . '/?$@' . ($this->matchUnicode?'u':'');
            if (preg_match($pattern, $uri, $paramValues) === 1) {// There is a match.
                // Extract parameter names.
                $paramNames = [];
                preg_match_all(self::MATCHES_REGEX, $this->url, $paramNames, PREG_PATTERN_ORDER);

                // Put parameters to array to be passed to controller/function later.
                foreach ($paramNames[0] as $index => $value) {
                    $this->params[substr($value, 1)] = urldecode($paramValues[$index + 1]);
                }

                // Append passed params to executable
                $this->executable->addParams($this->params);

                // Everything is done return true.
                return true;
            }
        }
        // No match found return false.
        return false;
    }
1251018
public static HttpResponse execute(final String url, final String method) {
        return execute(url, method, null, null, new HashMap<>(), new HashMap<>());
    }
579389
protected function response($method, $url, $data, $result)
    {
        if (!isset($result['$url'])) {
            $result['$url'] = $url;
        }
        if ($this->cache) {
            $this->cache->clear($result);
            if (strtolower($method) === 'get') {
                $this->cache->put($url, $data, $result);
            }
        }

        return $this->response_data($result, $method, $url);
    }
12976
private function _request($method, $url, array $options) {
		try {
			$response = $this->httpClient->{$method}($url, $options);
		} catch(ClientException $e) {
			$response = $e->getResponse();
		} catch(ConnectException $e) {
			$this->_throwServerError($e);
		} catch (RequestException $e) {
			$this->_throwServerError($e);
		}

		return $response;
	}
800246
public function send(string $method, string $url, array $options): HttpResponse
    {
        try {
            return new HttpResponse($this->buildClient()->request($method, $url, $this->mergeOptions([
                'query' => $this->parseQueryParams($url),
            ], $options)));
        } catch (\GuzzleHttp\Exception\ConnectException $e) {
            throw new Exceptions\ConnectionException($e->getMessage(), 0, $e);
        }
    }
34740
public function createRequest(string $method, $uri): RequestInterface
  {
    $request = new Request($method, $uri);

    \logger()->debug('Created PSR-7 Request("'.$method.'","'.$uri.'"") (Guzzle)');

    return $request;
  }
848590
public function getRetry(
        string $url,
        string $method
    ): ? Retry {
        $url = trim(trim(strtolower($url)), '/');
        $method = trim(strtolower($method));

        if (isset($this->retries[$url.'~~'.$method])) {
            return $this->retries[$url.'~~'.$method];
        }

        if (isset($this->retries['*~~'.$method])) {
            return $this->retries['*~~'.$method];
        }

        if (isset($this->retries[$url.'~~*'])) {
            return $this->retries[$url.'~~*'];
        }

        if (isset($this->retries['*~~*'])) {
            return $this->retries['*~~*'];
        }

        return null;
    }
360934
private function sendRequest($method, $url, array $options = [])
    {
        $response = $this->httpClient->request((string)$method, $url, $options);

        return json_decode($response->getBody(), true);
    }
346183
public function requestRaw(string $url, string $method = 'GET', array $options = [])
    {
        return Response::buildFromPsrResponse($this->request($url, $method, $options, true));
    }
488799
public function call(string $method)
    {
        $args = $this->getArgs($method);

        $return = call_user_func_array([$this, $method], $args);

        $out = $this->renderer->render($this->statusCode, $this->headers, $return);

        self::response()->addHeader('Content-Type', $this->renderer->getContentType());
        if ($this->renderer->sendHeader()) {
            foreach ($this->headers as $name => $value) {
                self::response()->addHeader('x-' . ucfirst($name), $value);
            }

            self::response()->setStatus($this->statusCode);
        }

        return $out;
    }
258363
public function update($url, $method) {
        $data = Values::of(array('Url' => $url, 'Method' => $method, ));

        $payload = $this->version->update(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new MemberInstance(
            $this->version,
            $payload,
            $this->solution['accountSid'],
            $this->solution['queueSid'],
            $this->solution['callSid']
        );
    }
69131
public function request($method, $url, $data = null)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            "Content-Type: application/json",
            "Authorization: {$this->public_key},{$this->secret_key}"
        ));
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_URL, $this->api_url . $url);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);

        if ($data !== null) {
            curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
        }

        $response = curl_exec($curl);

        if (curl_errno($curl)) {
            throw new Error('Curl error: ' . curl_error($curl));
        }
        $info = curl_getinfo($curl);
        if ($info['http_code'] != 200) {
            throw new Error('API responded with wrong status code (' . $info['http_code'] . ')', json_decode($response));
        }

        return $response;
    }
1035901
public function request($method, array $params = [])
    {
        $client = new \GuzzleHttp\Client();

        $multipartParams = [];
        foreach ($params as $key => $value) {
            $multipartParams[] = [
                'name' => $key,
                'contents' => is_scalar($value) ? (string)$value : $value
            ];
        }

        try {
            $response = $client->post($this->getUrl($method), [
                'verify' => false,
                'multipart' => $multipartParams ?: null
            ]);
            $response = json_decode($response->getBody());

            if ($response === null) {
                throw new HttpRuntimeException('Empty response.');
            }
            return new Response($response->ok, $response->result);
        } catch (ClientException $e) {
            $response = json_decode($e->getResponse()->getBody()->getContents());
            return new Response($response->ok, null, $response->error_code, $response->description);
        } catch (ServerException $e) {
            return new Response(false, null, $e->getResponse()->getStatusCode(), $e->getResponse()->getReasonPhrase());
        }
    }
507384
protected function response_data($result, $method, $url)
    {
        if (isset($result['$data'])) {
            if (is_array($result['$data'])) {
                return Resource::instance($result, $this);
            }
            return $result['$data'];
        }
        return null;
    }