Send a GET request

@param string $url      A valid URL
@param array  $params   Parameters as key/value pairs
@param array  $options  Curl options

@return object The Response including header and body
@throws Passioncoder\SimpleCurl\Exception
965389
public function get($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'GET', $params, $options);
	}
740640
protected function _curl($url,$options) {
		$curl=curl_init($url);
		if (!$open_basedir=ini_get('open_basedir'))
			curl_setopt($curl,CURLOPT_FOLLOWLOCATION,
				$options['follow_location']);
		curl_setopt($curl,CURLOPT_MAXREDIRS,
			$options['max_redirects']);
		curl_setopt($curl,CURLOPT_PROTOCOLS,CURLPROTO_HTTP|CURLPROTO_HTTPS);
		curl_setopt($curl,CURLOPT_REDIR_PROTOCOLS,CURLPROTO_HTTP|CURLPROTO_HTTPS);
		curl_setopt($curl,CURLOPT_CUSTOMREQUEST,$options['method']);
		if (isset($options['header']))
			curl_setopt($curl,CURLOPT_HTTPHEADER,$options['header']);
		if (isset($options['content']))
			curl_setopt($curl,CURLOPT_POSTFIELDS,$options['content']);
		if (isset($options['proxy']))
			curl_setopt($curl,CURLOPT_PROXY,$options['proxy']);
		curl_setopt($curl,CURLOPT_ENCODING,'gzip,deflate');
		$timeout=isset($options['timeout'])?
			$options['timeout']:
			ini_get('default_socket_timeout');
		curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,$timeout);
		curl_setopt($curl,CURLOPT_TIMEOUT,$timeout);
		$headers=[];
		curl_setopt($curl,CURLOPT_HEADERFUNCTION,
			// Callback for response headers
			function($curl,$line) use(&$headers) {
				if ($trim=trim($line))
					$headers[]=$trim;
				return strlen($line);
			}
		);
		curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,2);
		curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,FALSE);
		ob_start();
		curl_exec($curl);
		$err=curl_error($curl);
		curl_close($curl);
		$body=ob_get_clean();
		if (!$err &&
			$options['follow_location'] && $open_basedir &&
			preg_grep('/HTTP\/1\.\d 3\d{2}/',$headers) &&
			preg_match('/^Location: (.+)$/m',implode(PHP_EOL,$headers),$loc)) {
			$options['max_redirects']--;
			if($loc[1][0] == '/') {
				$parts=parse_url($url);
				$loc[1]=$parts['scheme'].'://'.$parts['host'].
					((isset($parts['port']) && !in_array($parts['port'],[80,443]))
						?':'.$parts['port']:'').$loc[1];
			}
			return $this->request($loc[1],$options);
		}
		return [
			'body'=>$body,
			'headers'=>$headers,
			'engine'=>'cURL',
			'cached'=>FALSE,
			'error'=>$err
		];
	}
782631
public function get($url, $params = null) {
    $this->params = $params;
    $this->method = 'GET';
    $this->url = $url;

    return $this->request();
  }
846341
public function fetch($url, $options)
    {
        $this->init();

        $request_type = $this->config->http_post === true ?
            'form_params' : 'query';
        $options = [$request_type => $options];

        try {
            $response = $this->client->request(
                $this->config->http_post === true ? 'POST' : 'GET',
                $url,
                $options
            );
        } catch (GuzzleException $exception) {
            throw new ConnectionException(
                $exception->getMessage(),
                $exception->getCode()
            );
        }

        if ($response->getStatusCode() >= 400) {
            // ccp is using error codes even if they send a valid application
            // error response now, so we have to use the content as result
            // for some of the errors. This will actually break if CCP ever uses
            // the HTTP Status for an actual transport related error.
            switch ($response->getStatusCode()) {
                case 400:
                case 403:
                case 500:
                case 503:
                    return $response->getBody()->getContents();
                    break;
            }

            throw new HTTPException(
                $response->getStatusCode(),
                $url
            );
        }

        return $response->getBody()->getContents();
    }
960953
public function request($method, $url, $options)
    {
        $request = $this->authClient->getAuthenticatedRequest($method, $url, $this->getAccessToken());

        return $this->httpClient->send($request, $options);
    }
595368
public function get($url, $params = array())
    {
        $request = $this->provider->request($url, $params);
        $response = $this->client->send($request);

        $data = $response->getBody()->getContents();
        $format = $this->getFormat($params, $response);

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

        return json_decode($response->getBody(), true);
    }
1065759
protected function executeRequest($url, array $options = array())
    {
        $ch = curl_init($url);

        foreach ($options as $name => $value) {
            if (!curl_setopt($ch, $name, $value)) {
                if ($this->logger) {
                    $this->logger->warning("Option could not be set to Curl: $name, value: $value");
                }
            }
        }

        // some options we have to force
        curl_setopt($ch, CURLOPT_FAILONERROR, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        $results = curl_exec($ch);
        if ($results === false) {
            if ($this->logger) {
                $this->logger->error("Curl request failed: " . curl_error($ch));
            }
        }

        // close cURL resource, and free up system resources
        curl_close($ch);

        return $results;
    }
189963
protected function api_call($url, $params) {
        $url = $this->build_rest_url($url, $params);
        $result = $this->curl($url);
        return json_decode($result);
    }
1366301
public static function post($url, $params)
    {
        if (!is_array($params)) {
            $params = self::ar($params);
        }

        $query = http_build_query($params);

        /*
         * open connection.
         */
        $ch = curl_init();

        /*
         * set the url, number of POST vars, POST data.
         */
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, count($params));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $query);

        /*
         * execute post.
         */
        $r = curl_exec( $ch );

        /*
         * close connection.
         */
        curl_close($ch);

        return $r;
    }
1146157
public function request($url, array $params = array())
    {
        $uri = $this->makeUri($url, $params);

        return new Psr7\Request('get', $uri);
    }
239347
public function request($url, $options)
    {
        $this->url = $url;
        $this->options = array_replace_recursive($this->settings['defaults'], $options);

        try {
            return $this->handleRequest();
        } catch (TokenExpiredException $e) {
            $this->refresh();

            return $this->handleRequest();
        }
    }
1043481
public function get($url, $params = array(), $options = array())
    {
        $client = new \GuzzleHttp\Client($options);
        $query = $this->getQueryParam4AccessToken();
        $params = array_merge($params, $query);
        $response = $client->get($url, array(
            'query' => $params
        ));
        if ($this->isSuccessful($response)) {
            return $this->getJson($response); // $response->json();
        } else {
            throw new Exception("微信服务器未有效的响应请求");
        }
    }
8680
public function post($url, array $params = null, array $options = array())
	{
		return $this->request($url, 'POST', $params, $options);
	}
1156013
protected function _curl($url,$options) {
		$curl=curl_init($url);
		curl_setopt($curl,CURLOPT_FOLLOWLOCATION,
			$options['follow_location']);
		curl_setopt($curl,CURLOPT_MAXREDIRS,
			$options['max_redirects']);
		curl_setopt($curl,CURLOPT_CUSTOMREQUEST,$options['method']);
		if (isset($options['header']))
			curl_setopt($curl,CURLOPT_HTTPHEADER,$options['header']);
		if (isset($options['content']))
			curl_setopt($curl,CURLOPT_POSTFIELDS,$options['content']);
		curl_setopt($curl,CURLOPT_ENCODING,'gzip,deflate');
		$timeout=isset($options['timeout'])?
			$options['timeout']:
			ini_get('default_socket_timeout');
		curl_setopt($curl,CURLOPT_CONNECTTIMEOUT,$timeout);
		curl_setopt($curl,CURLOPT_TIMEOUT,$timeout);
		$headers=array();
		curl_setopt($curl,CURLOPT_HEADERFUNCTION,
			// Callback for response headers
			function($curl,$line) use(&$headers) {
				if ($trim=trim($line))
					$headers[]=$trim;
				return strlen($line);
			}
		);
		curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,FALSE);
		ob_start();
		curl_exec($curl);
		curl_close($curl);
		$body=ob_get_clean();
		return array(
			'body'=>$body,
			'headers'=>$headers,
			'engine'=>'cURL',
			'cached'=>FALSE
		);
	}
1050036
public function post($url, $params = '', $curlOptions = array()) {
        if (is_array($params)) {
            $params = $this->makePostFields($params);
        }
        $curlOptions['CURLOPT_POST'] = 1;
        $curlOptions['CURLOPT_POSTFIELDS'] = $params;
        return $this->request($url, $curlOptions);
    }
517613
protected function sendRequest($url, array $params, $method)
    {
        $method = strtolower($method);
        $options = [
            CURLOPT_RETURNTRANSFER => true,
        ];

        if (self::REQUEST_METHOD_GET === $method) {
            $url .= '?' . http_build_query($params);
        } else {
            $options[CURLOPT_POST] = true;
            $options[CURLOPT_POSTFIELDS] = http_build_query($params);
        }

        $ch = curl_init($url);
        curl_setopt_array($ch, $options);
        $response = curl_exec($ch);

        if (!$response) {
            throw new \RuntimeException('cURL: ' . curl_error($ch), curl_errno($ch));
        }
        curl_close($ch);

        return $response;
    }