ManaPHP\Http\Client::request PHP Method

request() protected method

protected request ( string $type, string | array $url, string | array $data, array $headers, array $options ) : integer
$type string
$url string | array
$data string | array
$headers array
$options array
return integer
    protected function request($type, $url, $data, $headers, $options)
    {
        $this->_responseBody = false;
        $url = $this->_buildUrl($url);
        if (preg_match('/^http(s)?:\\/\\//i', $url) !== 1) {
            throw new ClientException('only HTTP requests can be handled: `:url`', ['url' => $url]);
        }
        $headers = array_merge($this->_headers, $headers);
        $options = array_merge($this->_options, $options);
        $eventData = ['type' => $type, 'url' => &$url, 'headers' => &$headers, 'data' => &$data, 'options' => &$options];
        $this->fireEvent('httpClient:beforeRequest', $eventData);
        $httpCode = $this->_request($type, $url, $data, $headers, $options);
        $eventData = ['type' => $type, 'url' => $url, 'headers' => $headers, 'data' => $data, 'options' => $options, 'httpCode' => &$httpCode, 'responseBody' => &$this->_responseBody];
        $this->fireEvent('httpClient:afterResponse', $eventData);
        return $httpCode;
    }