当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getQuery方法代码示例

本文整理汇总了PHP中Guzzle\Http\Message\Request::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getQuery方法的具体用法?PHP Request::getQuery怎么用?PHP Request::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Guzzle\Http\Message\Request的用法示例。


在下文中一共展示了Request::getQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testOnRequestBeforeSend

 public function testOnRequestBeforeSend()
 {
     $request = new Request('GET', 'https://example.com');
     $event = new Event(['request' => $request]);
     $oauth = new OAuth('example');
     $oauth->onRequestBeforeSend($event);
     $this->assertTrue($request->getQuery()->hasKey('access_token'));
     $this->assertEquals('example', $request->getQuery()->get('access_token'));
 }
开发者ID:mpscholten,项目名称:github-api,代码行数:9,代码来源:OAuthTest.php

示例2: testValidRawSignature

 /**
  * Testing the raw signature value before it's hashed.
  *
  * Signatures should match Ooyala's {@link http://support.ooyala.com/developers/documentation/tasks/api_signing_requests.html Signing Request Algorithm}.
  */
 public function testValidRawSignature()
 {
     $method = 'GET';
     $path = '/my/path';
     $key = '123';
     $secret = '456';
     // Purposely out of order to test sorting from the Response object query params.
     $queryParams = array('fake' => 'fake,param', 'another' => '123', 'key' => $key);
     $request = new Request($method, $path);
     foreach ($queryParams as $key => $val) {
         $request->getQuery()->set($key, $val);
         unset($key, $val);
     }
     $signature = new Signature($secret, $request);
     // Build expected signature by hand to simulate what \SheKnows\OoyalaApi\Signature::getRawSignature() does.
     // @see \SheKnows\OoyalaApi\Signature for more details.
     $expected = $secret . $method . $path;
     ksort($queryParams);
     // Sort manually, kind of makes for an ugly test :/
     foreach ($queryParams as $key => $val) {
         $expected .= "{$key}={$val}";
     }
     $this->assertEquals($expected, $signature->getRawSignature(), 'Raw signature should match {secret} + {HttpMethod} + {UriPath} + {ordered_query_params}');
     $this->assertEquals(43, strlen($signature), 'Hashed signature should be 43 characters in length.');
 }
开发者ID:sheknows,项目名称:ooyala-api-client,代码行数:30,代码来源:SignatureTest.php

示例3: setGetParameters

 /**
  * Functio to set GET parameters onto the
  * request
  *
  * @param array $params Key value array of get params
  */
 public function setGetParameters($params = array())
 {
     $query = $this->request->getQuery();
     foreach ($params as $key => $val) {
         $query->add($key, $val);
     }
 }
开发者ID:summer11123,项目名称:trucker,代码行数:13,代码来源:RestRequest.php

示例4: addQuery

 private function addQuery(Request $request, $timestamp, $nonce)
 {
     $query = $request->getQuery();
     $query->add(self::$keys['OAuthVersionKey'], self::$oAuthVersion);
     $query->add(self::$keys['OAuthTimestampKey'], $timestamp);
     $query->add(self::$keys['OAuthNonceKey'], $nonce);
     $query->add(self::$keys['OAuthSignatureMethodKey'], 'HMAC-SHA1');
     $query->add(self::$keys['OAuthConsumerKeyKey'], self::$consumer_key);
 }
开发者ID:wisembly,项目名称:semantria-php,代码行数:9,代码来源:SemantriaAuthClient.php

示例5: testCreatesCanonicalizedQueryString

 /**
  * @covers Aws\Common\Signature\AbstractSignature::getCanonicalizedQueryString
  * @dataProvider queryStringProvider
  */
 public function testCreatesCanonicalizedQueryString($headers, $string)
 {
     // Make the method publicly callable
     $method = new \ReflectionMethod('Aws\\Common\\Signature\\AbstractSignature', 'getCanonicalizedQueryString');
     $method->setAccessible(true);
     // Create a request and replace the headers with the test headers
     $request = new Request('GET', 'http://www.example.com');
     $request->getQuery()->replace($headers);
     $this->assertEquals($string, $method->invoke($this->signature, $request));
 }
开发者ID:cstuder,项目名称:nagios-plugins,代码行数:14,代码来源:AbstractSignatureTest.php

示例6: testAssertEmptyParametersAreStrippedWhenSignRequest

 /**
  * @covers PusherSignature::signRequest
  */
 public function testAssertEmptyParametersAreStrippedWhenSignRequest()
 {
     $request = new HttpRequest('POST', '/apps/3/events');
     // We set variables in query to have always the same result
     $request->getQuery()->replace(array('key-with-value' => 'value', 'key-without-value' => ''));
     $this->pusherSignature->signRequest($request, $this->credentials);
     $queryParameters = $request->getQuery()->toArray();
     $this->assertArrayHasKey('key-with-value', $queryParameters);
     $this->assertArrayNotHasKey('key-without-value', $queryParameters);
 }
开发者ID:GedConk,项目名称:zfr-pusher,代码行数:13,代码来源:PusherSignatureTest.php

示例7: testClonedRequestsUseNewInternalState

 /**
  * @covers Guzzle\Http\Message\Request::__clone
  */
 public function testClonedRequestsUseNewInternalState()
 {
     $p = new AsyncPlugin();
     $this->request->getEventDispatcher()->addSubscriber($p);
     $h = $this->request->getHeader('Host');
     $r = clone $this->request;
     $this->assertEquals(RequestInterface::STATE_NEW, $r->getState());
     $this->assertNotSame($r->getQuery(), $this->request->getQuery());
     $this->assertNotSame($r->getCurlOptions(), $this->request->getCurlOptions());
     $this->assertNotSame($r->getEventDispatcher(), $this->request->getEventDispatcher());
     $this->assertEquals($r->getHeaders(), $this->request->getHeaders());
     $this->assertNotSame($h, $r->getHeader('Host'));
     $this->assertNotSame($r->getParams(), $this->request->getParams());
     $this->assertTrue($this->request->getEventDispatcher()->hasListeners('request.sent'));
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:18,代码来源:RequestTest.php

示例8: fromRequest

 public function fromRequest(Request $request, $secretKey)
 {
     $method = strtolower($request->getMethod());
     switch ($method) {
         case 'post':
         case 'patch':
         case 'put':
         case 'delete':
             $body = (string) $request->getBody();
             break;
         default:
             $body = $request->getQuery(true);
     }
     return $this->generate($body, $secretKey);
 }
开发者ID:chartblocks,项目名称:php-rest-sdk,代码行数:15,代码来源:Signature.php

示例9: signRequest

 /**
  * @param \Guzzle\Http\Message\Request $request
  */
 public function signRequest(Request $request)
 {
     $url = $request->getPath();
     if ('POST' == $request->getMethod() && $request instanceof EntityEnclosingRequest) {
         $body = (string) $request->getBody();
         $hash = $this->signature->generate($body);
     } else {
         $url .= '?' . $request->getQuery();
         $hash = $this->signature->generate($url);
     }
     $request->addCookie('acquia_solr_time', $this->signature->getRequestTime());
     $request->addCookie('acquia_solr_nonce', $this->signature->getNonce());
     $request->addCookie('acquia_solr_hmac', $hash . ';');
     // The timestamp should be current for each request.
     $this->signature->unsetRequestTime();
 }
开发者ID:caxy,项目名称:acquia-sdk-php,代码行数:19,代码来源:AcquiaSearchAuthPlugin.php

示例10: addApiKey

 /**
  * @param \Guzzle\Http\Message\Request $request
  * @param string $apiKey
  *
  * @return \BigOven\BigOvenAuthPlugin
  */
 public function addApiKey(Request $request, $apiKey)
 {
     $request->getQuery()->set('api_key', $apiKey);
     return $this;
 }
开发者ID:cpliakas,项目名称:bigoven-php,代码行数:11,代码来源:BigOvenAuthPlugin.php

示例11: updateQueryParams

 /**
  * @param GuzzleRequest $request
  */
 private function updateQueryParams(GuzzleRequest $request)
 {
     foreach ($this->queryParams as $name => $value) {
         $request->getQuery()->add($name, $value);
     }
 }
开发者ID:allegro,项目名称:toper,代码行数:9,代码来源:Request.php

示例12: prepareQuery

 /**
  * Prepare the query string before the API request.
  *
  * @param \Guzzle\Http\Message\Request $request
  * @param array                        $tricks
  *
  * @return \Guzzle\Http\Message\Request
  */
 protected function prepareQuery(GuzzleRequest $request, $tricks)
 {
     $threads = $this->getThreadsArray($tricks);
     $aggregator = $this->getQueryAggregator();
     $request->getQuery()->set('forum', $this->getConfig('forum'))->set('thread', $threads)->set('api_key', $this->getConfig('publicKey'))->setAggregator($aggregator);
     return $request;
 }
开发者ID:phpspider,项目名称:laravel-tricks,代码行数:15,代码来源:Disqus.php

示例13: getQueryString

 public function getQueryString()
 {
     return (string) $this->_request->getQuery();
 }
开发者ID:sokil,项目名称:php-rest,代码行数:4,代码来源:Request.php

示例14: preprocessRequest

 /**
  * Allow adapter to modify request before sending,
  * adding API key by default
  *
  * @param Request $request
  */
 protected function preprocessRequest(Request $request)
 {
     $request->getQuery()->add('key', $this->getApiKey());
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:AbstractAPIAdapter.php

示例15: getParamsToSign

 public function getParamsToSign(\Guzzle\Http\Message\Request $request)
 {
     return $request->getQuery()->toArray();
 }
开发者ID:francodacosta,项目名称:caparica-guzzle-plugin,代码行数:4,代码来源:CaparicaGuzzlePlugin.php


注:本文中的Guzzle\Http\Message\Request::getQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。