Send GET request

@param string $url
@param array $data
@param array $headers
@param int $cacheMinutes

@throws TwitterException
@return Response
173991
public function get($url, array $data = [], array $headers = [], $cacheMinutes = 30)
    {
        return $this->send('get', $url, $data, $headers, $cacheMinutes);
    }
749337
protected function sendRequest($method, $url, $data = array(), $headers = array()) {
        $contextOptions = array(
            'http' => array(
                'method' => $method,
                'user_agent' => 'MinecraftJP-PHP-SDK/' . self::VERSION,
                'ignore_errors' => true,
            ),
        );

        if ($method == 'POST' && is_array($data)) {
            $formEncoded = http_build_query($data);
            $headers['Content-Type'] = 'application/x-www-form-urlencoded';
            $headers['Content-Length'] = strlen($formEncoded);
            $contextOptions['http']['content'] = $formEncoded;
        }

        $contextOptions['http']['header'] = '';
        foreach ($headers as $k => $v) {
            $contextOptions['http']['header'] .= $k . ': ' . $v . "\r\n";
        }
        $context = stream_context_create($contextOptions);

        $body = file_get_contents($url, false, $context);
        return new HttpResponse($http_response_header, $body);
    }
219935
protected function connect($url, $headers = null)
    {
        if (!empty($headers)) {
            $client = new Client(['headers' => $headers]);
        }
        else {
            $client = new Client();
        }
        $request = $client->get($url);
        $response = $request->getBody()->getContents();

        return $response;
    }
1003624
public static function post($url, $headers = array(), $data = array(), $options = array()) {
		return self::request($url, $headers, $data, self::POST, $options);
	}
1343432
public function get($url, $queries = null, callable $callback = null)
    {
        if ( is_array($queries) )
        {
            $queries = '?' . http_build_query($queries);
        }

        return $this->send($url . $queries, self::GET, [], $callback);
    }
949919
public function getTweetsFromUser($username, $count = 10, $cacheMinutes = 30, $returnEntities = true)
    {
        $count = $this->getVerifiedCount($count, 1, 200);

        $endpoint = '/statuses/user_timeline.json';

        $url = $this->urlHelper->joinSlugs([$this->baseUrl, $this->apiVersion, $endpoint]);

        $data = [
            'screen_name' => $username,
            'count' => $count
        ];

        $headers = [
            'Authorization' => 'Bearer ' . $this->requestAppAccessToken()
        ];

        $response = $this->courier->get($url, $data, $headers, $cacheMinutes);

        if ($returnEntities)
        {
            $tweets = $response->toArray();
            $response = $this->createTweetEntities($tweets);
        }

        return $response;
    }
1106537
protected function proccessRequest($url, &$params, &$data, $headers){

        $token = isset($params['access_token']) ? $params['access_token'] : '';
        $data['cuid'] = md5($token);

        if($url === $this->asrUrl){
            $data['token'] = $token;
            $data = json_encode($data);
        }else{
            $data['tok'] = $token;
        }

        unset($params['access_token']);
    }
479517
private function send_http($url, $data, $headers=[])
    {
        if ($this->curl_method == 'async') {
            $this->_curl_handler->enqueue($url, $data, $headers);
        } elseif ($this->curl_method == 'exec') {
            $this->send_http_asynchronous_curl_exec($url, $data, $headers);
        } else {
            $this->send_http_synchronous($url, $data, $headers);
        }
    }
554479
public function get($url, $headers = [], $parameters = null)
    {
        return $this->send(Method::GET, $url, $parameters, $headers);
    }
969655
public function post($url, $data, $headers = [])
    {
        $request = new Request('POST', $url, $headers);
        $response = $this->apiClient->send(
            $request,
            [
                'form_params' => $data,
            ]
        );
        $result = json_decode($response->getBody(), true);
        return $result;
    }
792168
private function send($method, $url, array $data = [], array $headers = [], $cacheMinutes = 0)
    {
        $method = strtolower($method);

        try
        {
            return $this->courier->$method($url, $data, $headers, $cacheMinutes);
        }
        catch (HttpRequestException $exception)
        {
            $response = $exception->response();

            if ($response->getResponseType() == 'application/json')
            {
                $response = $response->toArray();
                $error = sprintf('Twitter Error: %s (Error %d)', $response['errors'][0]['message'], $response['errors'][0]['code']);
            }
            else
            {
                $error = sprintf('HTTP Error: %s (Error %d)', $exception->getMessage(), $exception->getCode());
            }

            throw new TwitterException($error);
        }
    }
598429
public static function post($url, array $data = [], array $headers = [])
    {
        // $headers = [ 'Content-Type: application/json' ];

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // 发送数据
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        // 执行HTTP请求
        return self::execute($ch);
    }
1350508
protected function request($urlParams, $cacheName)
    {
        if (Cache::has($cacheName)) {
            return Cache::get($cacheName);
        }

        try {
            $client = new GuzzleClient([
                'headers' => [
                    'Content-Type'  => 'application/x-yametrika+json',
                    'Authorization' => 'OAuth '.config('yandex-metrika.token'),
                ],
            ]);

            $response = $client->request('GET', $this->url,
                ['query' => $urlParams]);

            $result = json_decode($response->getBody(), true);

        } catch (ClientException $e) {
            Log::error('Yandex Metrika: '.$e->getMessage());

            $result = null;
        }

        if ($result) {
            Cache::put($cacheName, $result, config('yandex-metrika.cache'));
        }

        return $result;
    }
1236636
public function get($url, $query = [], $headers = [])
    {
        $headers = array_merge($this->global_headers, $headers);

        return $this->request('GET', $url, [], $query, $headers);
    }
1145810
private function getCachedResponse($method, $url, array $data, array $headers)
    {
        if ($this->cache)
        {
            return $this->cache->findResponse($method, $url, $data, $headers, $this->basicAuthCredentials);
        }

        return false;
    }
925357
public function put($url, $data = '', array $headers = [])
    {
        return $this->executor->execute(
            $url,
            [
                CURLOPT_CUSTOMREQUEST  => 'PUT',
                CURLOPT_HTTPHEADER => $headers,
                CURLOPT_POSTFIELDS => $data,
            ]
        );
    }
371297
private function buildRequest($url, array $headers = []): RequestInterface
    {
        $request = $this->requestFactory->createRequest('GET', $url);
        foreach ($headers as $header => $value) {
            $request = $request->withHeader($header, $value);
        }

        return $request;
    }