performs the request.

@param string $url
@param string $method
@param array  $params

@return array
18747
protected function request($url, $method = 'GET', array $params = [])
    {
        $url = $this->sanitizeQuery($url);

        $response = $this->client->request($method, $url, $params);

        if (is_array($response) && isset($response['paging'])) {
            $response = $this->injectPager($response, $method, $url, $params);
        }

        return $response;
    }
394983
public function request($id, $method, array $params = null)
    {
        return $this->createRequest(RequestInterface::REQUEST, array_filter([
            'jsonrpc' => self::SPEC,
            'method' => $method,
            'params' => $params,
            'id' => $id,
        ]));
    }
375417
public function sendRequest($url, $params, $method)
    {
        try{
            if (!empty($params['html'])){
                $commandName = 'GenerateFromHTML';
            }
            else if (!empty($params['url'])){
                $commandName = 'GenerateFromURL';
            }
            else if (!empty($params['file'])&& $url=='pdf'){
                $commandName = 'GenerateFromFile';
            }
            else {
                $operations = $this->getDescription()->getOperations();
                foreach ($operations as $operation)
                {
                    if ($operation->getUri()==$url && $operation->getHttpMethod() == $method)
                    {
                        $commandName = $operation->getName();
                    }
                }
            }
            $command = $this->getCommand($commandName, $params);
            $ret = $this->execute($command);

            if ( $commandName == 'GetAssetList' || $commandName == 'UploadAsset' )
            {
                return json_encode($ret);
            }
            return $ret->getBody(true);

        }catch(ClientErrorResponseException $exception){
            throw new \Exception($exception->getResponse()->getBody(true), $exception->getResponse()->getStatusCode());
        }
    }
131225
public function makeRequest($url, $method='GET', array $parameters=array())
    {
        //Set cURL options
        $this->curl_opts[CURLOPT_URL]        = $url;
        $this->curl_opts[CURLOPT_HTTPHEADER] = $this->headers->getHeaders();

	// Prepare Data
        if (!empty($parameters)) {
            switch($method) {
                case 'POST':
                    $this->curl_opts[CURLOPT_POST] = true;
                    $this->curl_opts[CURLOPT_POSTFIELDS] = Utilities::encodeUrlParam($parameters);
                    break;
                case 'PUT':
                    $file_handle = fopen($parameters, 'r');
                    $this->curl_opts[CURLOPT_PUT] = true;
                    $this->curl_opts[CURLOPT_INFILE] = $file_handle;
                    break;
                case 'DELETE':
                    $this->curl_opts[CURLOPT_CUSTOMREQUEST] = 'delete';
                    break;
            }
        }

        $response = $this->doCurlCall();

		if ($response['response'] === false) {
			throw new RequestException($response['errorMessage'], $response['errorNumber']);
		}

        return $response;
    }
786130
protected function request($url, $method = self::GET, $params = array(), $options = array())
    {
        if ($method === self::GET || $method === self::DELETE) {
            $url .= (stripos($url, '?') ? '&' : '?').http_build_query($params);
            $params = array();
        }

        curl_setopt($this->curl, CURLOPT_HEADER, 1);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);

        curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, $method);
        curl_setopt($this->curl, CURLOPT_URL, $url);

        //使用证书情况
        if (isset($options['sslcert_path']) && isset($options['sslkey_path'])) {
            if (!file_exists($options['sslcert_path']) || !file_exists($options['sslkey_path'])) {
                throw new \Exception('Certfile is not correct');
            }
            //设置证书
            //使用证书：cert 与 key 分别属于两个.pem文件
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 2);//严格校验
            curl_setopt($this->curl, CURLOPT_SSLCERTTYPE, 'PEM');
            curl_setopt($this->curl, CURLOPT_SSLCERT, $options['sslcert_path']);
            curl_setopt($this->curl, CURLOPT_SSLKEYTYPE, 'PEM');
            curl_setopt($this->curl, CURLOPT_SSLKEY, $options['sslkey_path']);
        } else {
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYHOST, 0);
            curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, 0);
        }

        // Check for files
        if (isset($options['files']) && count($options['files'])) {
            foreach ($options['files'] as $index => $file) {
                $params[$index] = $this->createCurlFile($file);
            }

            version_compare(PHP_VERSION, '5.5', '>') || curl_setopt($this->curl, CURLOPT_SAFE_UPLOAD, false);

            curl_setopt($this->curl, CURLOPT_POST, 1);
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $params);
        } else {
            if (isset($options['json'])) {
                $params = JSON::encode($params);
                $options['headers'][] = 'content-type:application/json';
            }

            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $params);
        }

        // Check for custom headers
        if (isset($options['headers']) && count($options['headers'])) {
            curl_setopt($this->curl, CURLOPT_HTTPHEADER, $options['headers']);
        }

        // Check for basic auth
        if (isset($options['auth']['type']) && 'basic' === $options['auth']['type']) {
            curl_setopt($this->curl, CURLOPT_USERPWD, $options['auth']['username'].':'.$options['auth']['password']);
        }

        $response = $this->doCurl();

        // Separate headers and body
        $headerSize = $response['curl_info']['header_size'];
        $header = substr($response['response'], 0, $headerSize);
        $body = substr($response['response'], $headerSize);

        $results = array(
                    'curl_info' => $response['curl_info'],
                    'content_type' => $response['curl_info']['content_type'],
                    'status' => $response['curl_info']['http_code'],
                    'headers' => $this->splitHeaders($header),
                    'data' => $body,
                   );

        return $results;
    }
1244851
public function request($method, $params = [])
    {
        $response = $this->client->post($this->getUrl($method), ['query' => $params]);

        if ($response->getStatusCode() === 200) {
            return (string)$response->getBody();
        } else {
            throw new Exception(sprintf('Sms.ru problem. Status code is %s', $response->getStatusCode()), $response->getStatusCode());
        }
    }
274314
public function post($url, array $params = [])
    {
        return $this->request($this->createUrl($url), self::METHOD_POST, $params);
    }
260865
public function request(string $method, ...$params) : ResponseInterface
    {
        try {
            $response = $this->client
                ->post($this->path, $this->makeJson($method, $params));

            if ($response->hasError()) {
                // throw exception on error
                throw new BadRemoteCallException($response);
            }

            return $response;
        } catch (Throwable $exception) {
            throw exception()->handle($exception);
        }
    }
410522
private function requestAPI($method, $url, array $options = [])
    {
        try {
            return $this->sendRequest((string)$method, (string)$url, $options);
        } catch (SessionWasExpiredException $e) {
            return $this->sendRequest((string)$method, (string)$url, $options);
        } catch (ClientException $e) {
            throw new BunqException($e);
        }
    }
360934
private function sendRequest($method, $url, array $options = [])
    {
        $response = $this->httpClient->request((string)$method, $url, $options);

        return json_decode($response->getBody(), true);
    }
789304
public function request($method, array $params) {
        // invariable parameters:
        $params['login'] = $this->_login;
        $params['apiKey'] = $this->_apiKey;
        $params['format'] = 'json'; 
        $params = http_build_query($params);

        $url = self::BITLY_API_URL.$method.'?'.$params;
        $response = $this->getHttpClient()
                         ->setMethod(Zend_Http_Client::GET)
                         ->setUri($url)
                         ->request()
        ;
        return Zend_Json::decode($response->getBody());
    }
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;
	}
851610
protected function sendRequest($url, $method = 'GET', $params = [])
    {
        $request = $this->createRequest()
            ->setMethod($method)
            ->setUrl($url)
            ->setData($params);

        if ($this->verifyPeer !== null) {
            $options = [
                'sslVerifyPeer' => $this->verifyPeer
            ];
            if ($this->capath) {
                $options['sslCapath'] = $this->capath;
            }
            if ($this->cainfo) {
                $options['sslCafile'] = $this->cainfo;
            }
            $request->addOptions($options);
        }

        $response = $request->send();

        if ($method == 'HEAD') {
            $headers = [];
            foreach ($response->getHeaders()->toArray() as $name => $values) {
                $headers[strtolower($name)] = array_pop($values);
            }
            return $headers;
        }

        return $response->getContent();
    }
180293
public function sendRequest($url, $params, $method)
    {
        if($method=='POST')
        {
            if (!empty($params['file']))
                $ch = $this->initiateUpload($url, $params);
            else
                $ch = $this->initiatePost($url, $params);
        }
        else if($method=='GET')
        {
            $ch = $this->initiateGet($url, $params);
        }
        else if($method=='DELETE')
        {
            $ch = $this->initiateDelete($url, $params);
        }
        else{
            throw new \Exception("Method ".$method." not supported!");
        }

        if (! $ret = curl_exec($ch))
        {
            trigger_error(curl_error($ch));
        }

        curl_close($ch);
        return $ret;
    }
370775
public function sendRequest($method, $params = [])
    {
        $request = $this->request($method, $params);
        $this->lastResponse = $this->client->sendRequest($request);
        if ($this->lastResponse->isError()) {
            $this->lastResponse->throwException();
        }

        return $this->lastResponse;
    }
667809
private function performRequest($method, $url, $options) {

        try {
            switch ($method) {
                case 'GET':
                    return json_decode($this->client->get($url, $options)->getBody(), true);
                case 'POST':
                    return json_decode($this->client->post($url, $options)->getBody(), true);
                case 'PUT':
                    return json_decode($this->client->put($url, $options)->getBody(), true);
                case 'DELETE':
                    return json_decode($this->client->delete($url, $options)->getBody(), true);
                default:
                    return null;
            }
        } catch (RequestException $e) {
            throw ApiException::create($e);
        }
    }
126030
protected function execute($request_method, $url, $parameters = null)
	{
		$extra_options = array(
			CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
			CURLOPT_USERPWD => $this->_apiUsername . ':' . $this->_apiKey,
		);

		$url = 'https://www.browserstack.com/automate/' . $url;

		list($raw_results,) = $this->_curlService->execute($request_method, $url, $parameters, $extra_options);

		return json_decode($raw_results, true);
	}