Execute a GET request against an API endpoint,
optionally with a given Request object as parameters

@param  string          $uri     Endpoint URL
@param  AbstractRequest $request = null Request object for parameters
@return string          Response data
190295
public function get($uri, AbstractRequest $request = null)
    {
        $http = $this->getHttpClone();

        if ($request) {
            $requestUri = $this->buildQuery($uri, $request->getQuery());
        } else {
            $requestUri = $uri;
        }

        $http->setOption(CURLOPT_URL, $requestUri);

        return $http->execute();
    }
1013690
public function get($uri, array $headers = [], $body = null)
    {
        return $this->send(new \GuzzleHttp\Psr7\Request('GET', $uri, $headers, $body));
    }
61515
protected function _getUrlFromRequest(UriInterface $uri, $getFullUrl = false)
    {
        if (property_exists($uri, 'base')) {
            $uri = $uri->withPath($uri->base . $uri->getPath());
        }

        if ($getFullUrl) {
            return (string)$uri;
        }

        return $uri->getPath();
    }
933554
public static <T> T executeXmlResult(HttpUriRequest request,Class<T> clazz){
		return execute(request,XmlResponseHandler.createResponseHandler(clazz));
	}
266284
public function get($uri, array $options = null)
    {
        return $this->request(self::REQUEST_METHOD_GET, $uri, null, $options);
    }
84909
public function cgetAction(Request $request)
    {
        $locale = $this->getUser()->getLocale();

        if ('true' == $request->get('flat')) {
            /** @var RestHelperInterface $restHelper */
            $restHelper = $this->get('sulu_core.doctrine_rest_helper');

            $fieldDescriptors = $this->getFieldDescriptors();
            $listBuilder = $this->generateFlatListBuilder();
            $restHelper->initializeListBuilder($listBuilder, $fieldDescriptors);
            $this->applyRequestParameters($request, $listBuilder);

            $listResponse = $listBuilder->execute();
            $listResponse = $this->addLogos($listResponse, $locale);

            $list = new ListRepresentation(
                $listResponse,
                self::$entityKey,
                'get_accounts',
                $request->query->all(),
                $listBuilder->getCurrentPage(),
                $listBuilder->getLimit(),
                $listBuilder->count()
            );
            $view = $this->view($list, 200);
        } else {
            $filter = $this->retrieveFilter($request);
            $accountManager = $this->getAccountManager();
            $accounts = $accountManager->findAll($locale, $filter);
            $list = new CollectionRepresentation($accounts, self::$entityKey);
            $view = $this->view($list, 200);
        }

        $context = new Context();
        $context->setGroups(['fullAccount', 'partialContact', 'Default']);
        $view->setContext($context);

        return $this->handleView($view);
    }
422427
protected function executeRequest($request)
    {
        // 请求微信服务器
        $result = $this->request->curlPost($request->getRequestUrl(), $request->params());

        $result = (array)simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA);

        return $result;
    }
79001
function requestURI( $uri )
    {
        $parsed = parse_url( $uri );

        $return = '';
        if ( isset( $parsed['user'] ) )
        {
            $return .= $parsed['user'] . '@' . $parsed['pass'];
        }
        $return .= rtrim( $parsed['path'], '/' ) . '/' . $this->Name;

        if ( isset( $parsed['query'] ) )
        {
            $return  .= '?' . $parsed['query'];
        }
        if ( isset( $parsed['fragment'] ) )
        {
            $return .= '#' . $parsed['fragment'];
        }

        return $return;
    }
364649
public function api($request = null, $response = null, $sendResponse = true)
    {
        $this->klein->respond('POST', '/authenticate', $this->authenticate);
        $this->klein->onHttpError($this->handleError);

        // see https://github.com/klein/klein.php/wiki/Sub-Directory-Installation
        if ($request === null)
            $request = Request::createFromGlobals();

        // Grab the server-passed "REQUEST_URI"
        $uri = $request->server()->get('REQUEST_URI');

        // Set the request URI to a modified one (without the "subdirectory") in it
        $request->server()->set('REQUEST_URI', '/' . substr($uri, strlen($this->configuration['basePath'])));

        // Pass our request to our dispatch method
        $this->klein->dispatch($request, $response, $sendResponse);
    }
471382
public function execute(string $uri = null) : ApplicationInterface
    {
        /** @var RouteInterface $route */
        $route = App::resolve('Router')->getRoute($uri);

        /** @var Middleware $middleware */
        $middleware = App::resolve('Middleware', [$route->getMiddlewares()]);

        $this->results = $middleware->dispatch(function () use ($route, $uri) {
            return App::resolve('FrontController')->dispatch($route)->getResult();
        });

        return $this;
    }
724180
protected <T> Optional<T> executeGetRequest(URI uri, GenericType<T> returnType)
    {
        return executeGetRequest(uri, null, null, returnType);
    }
1138130
private function request($method, $uri, array $options = array())
    {
        $options['auth'] = array($this->accessKey, $this->secretKey);

        return $this->httpClient->request($method, $uri, $options);
    }
767626
public function requestEndpoint(AbstractEndpoint $endpoint)
    {
        return $this->request(
            \ltrim($endpoint->getURI(), '/'),
            $endpoint->getMethod(),
            null === $endpoint->getBody() ? [] : $endpoint->getBody(),
            $endpoint->getParams()
        );
    }
184558
public function executeRequest(Request $request)
  {
    $curl = curl_init();

    if ($request->getPostBody()) {
      curl_setopt($curl, CURLOPT_POSTFIELDS, $request->getPostBody());
    }

    $requestHeaders = $request->getRequestHeaders();
    if ($requestHeaders && is_array($requestHeaders)) {
      $curlHeaders = array();
      foreach ($requestHeaders as $k => $v) {
        $curlHeaders[] = "$k: $v";
      }
      curl_setopt($curl, CURLOPT_HTTPHEADER, $curlHeaders);
    }
    curl_setopt($curl, CURLOPT_URL, $request->getUrl());

    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $request->getRequestMethod());
    curl_setopt($curl, CURLOPT_USERAGENT, $request->getUserAgent());

    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);

    // The SSL version will be determined by the underlying library
    // @see https://github.com/google/google-api-php-client/pull/644
    //curl_setopt($curl, CURLOPT_SSLVERSION, 1);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, true);

    if ($request->canGzip()) {
      curl_setopt($curl, CURLOPT_ENCODING, 'gzip,deflate');
    }
    
    $options = $this->client->getClassConfig('Curl', 'options');
    if (is_array($options)) {
      $this->setOptions($options);
    }
    
    foreach ($this->options as $key => $var) {
      curl_setopt($curl, $key, $var);
    }

    if (!isset($this->options[CURLOPT_CAINFO])) {
      curl_setopt($curl, CURLOPT_CAINFO, dirname(__FILE__) . '/cacerts.pem');
    }

    $this->client->getLogger()->debug(
        'cURL request',
        array(
            'url' => $request->getUrl(),
            'method' => $request->getRequestMethod(),
            'headers' => $requestHeaders,
            'body' => $request->getPostBody()
        )
    );

    $response = curl_exec($curl);
    if ($response === false) {
      $error = curl_error($curl);
      $code = curl_errno($curl);
      $map = $this->client->getClassConfig('Exception', 'retry_map');

      $this->client->getLogger()->error('cURL ' . $error);
      throw new Exception($error, $code, null, $map);
    }
    $headerSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);

    list($responseHeaders, $responseBody) = $this->parseHttpResponse($response, $headerSize);
    $responseCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

    $this->client->getLogger()->debug(
        'cURL response',
        array(
            'code' => $responseCode,
            'headers' => $responseHeaders,
            'body' => $responseBody,
        )
    );

    return array($responseBody, $responseHeaders, $responseCode);
  }
1199642
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);
        $details = ArrayObject::ensureArrayObject($request->getModel());

        $httpRequest = new GetHttpRequest();
        $this->gateway->execute($httpRequest);

        if (isset($httpRequest->request['RtnCode']) === true) {
            if ($this->api->verifyHash($httpRequest->request) === false) {
                $httpRequest->request['RtnCode'] = '10400002';
            }
            $details->replace($httpRequest->request);

            return;
        }

        $token = $request->getToken();
        $targetUrl = $token->getTargetUrl();

        if (empty($details['OrderResultURL']) === true) {
            $details['OrderResultURL'] = $targetUrl;
        }

        if (empty($details['ReturnURL']) === true) {
            $notifyToken = $this->tokenFactory->createNotifyToken(
                $token->getGatewayName(), $token->getDetails()
            );
            $details['ReturnURL'] = $notifyToken->getTargetUrl();
        }
        $this->gateway->execute(new CreateTransaction($details));
    }
1275917
public function get($uri, array $params = array())
    {

        $request = HttpFoundation\Request::create($uri, 'GET', $params);
        $uri = $request->getUri();

        $ch = $this->initCurlHandler($uri);
        return $this->makeRequest($ch);

    }
62466
public function send(AbstractRequest $request)
    {
        $params = array_merge($request->getParams(), [
            'app_key' => $this->appKey,
            'sign_method' => 'md5',
            'timestamp' => date('Y-m-d H:i:s'),
            'format' => 'json',
            'v' => '2.0',
            'method' => $request->getMethod()
        ]);

        // 生成签名
        $params['sign'] = $this->buildSignature($params, $this->appSecret);

        $client = new GuzzleHttp();

        // 发起请求
        $response = $client->get($this->getUrl() . '?' . build_query($params));

        return new Response($response, $request);
    }