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


PHP Request::getUrl方法代码示例

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


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

示例1: isTestConnection

 /**
  * is test connection
  * @return boolean
  */
 private function isTestConnection()
 {
     $url = $this->request->getUrl(true);
     if ($url->getPath() == '/k/v1/form.json' && $url->getQuery()->get('app') == -1) {
         // 通信テスト成功
         return true;
     }
     return false;
 }
开发者ID:cstap,项目名称:kintone-sdk-php,代码行数:13,代码来源:KintoneError.php

示例2: printResult

 public function printResult()
 {
     echo sprintf('%s %s : %s calls', strtoupper($this->request->getMethod()), $this->request->getUrl(), $this->nbCalls) . PHP_EOL;
     foreach ($this->httpTimeDataCollector->getIterator() as $httpTimeResult) {
         echo sprintf('total time = %s ms', $httpTimeResult) . PHP_EOL;
     }
     echo '--- statistics ---' . PHP_EOL;
     echo sprintf('results filter on %s percentile', $this->httpTimeDataCollector->getPercentile()) . PHP_EOL;
     echo sprintf('min/avg/max = %s/%s/%s ms', $this->httpTimeDataCollector->getMinTime(), $this->httpTimeDataCollector->getAverageTime(), $this->httpTimeDataCollector->getMaxTime()) . PHP_EOL;
 }
开发者ID:rezzza,项目名称:tk1-contexts,代码行数:10,代码来源:HttpResponseTimeBenchmark.php

示例3: testOnRequestBeforeSendPOST

 public function testOnRequestBeforeSendPOST()
 {
     $request = new Request('POST', 'www.url.com');
     $event = new Event(array('request' => $request));
     $this->plugin->onRequestBeforeSend($event);
     $this->assertContains('key=' . $this->key, $request->getUrl());
 }
开发者ID:opdavies,项目名称:nwdrupalwebsite,代码行数:7,代码来源:KeyAuthPluginTest.php

示例4: testUrlEncodedSignature

 /**
  * Guzzle should take care of encoding signatures. This test is just a safety net to ensure that happens.
  */
 public function testUrlEncodedSignature()
 {
     $expected = '1234 ] 5678';
     $request = new Request('GET', "/fake?signature={$expected}");
     $url = explode('signature=', $request->getUrl());
     $signature = end($url);
     $this->assertEquals(rawurlencode($expected), $signature, 'Request should be encoding the signature before sending (required by Ooyala).');
 }
开发者ID:sheknows,项目名称:ooyala-api-client,代码行数:11,代码来源:SignatureTest.php

示例5: addAuthenticationHeaders

 /**
  * Sign the current request for write operations
  *
  * @param Request $request The current request
  */
 private function addAuthenticationHeaders(Request $request)
 {
     $client = $request->getClient();
     // Get a GMT/UTC timestamp
     $timestamp = gmdate('Y-m-d\\TH:i:s\\Z');
     // Build the data to base the hash on
     $data = $request->getMethod() . '|' . $request->getUrl() . '|' . $client->getConfig('publicKey') . '|' . $timestamp;
     // Generate signature
     $signature = hash_hmac('sha256', $data, $client->getConfig('privateKey'));
     // Add relevant request headers (overwriting once that might already exist)
     $request->setHeader('X-Imbo-Authenticate-Signature', $signature);
     $request->setHeader('X-Imbo-Authenticate-Timestamp', $timestamp);
 }
开发者ID:sgulseth,项目名称:imboclient-php,代码行数:18,代码来源:Authenticate.php

示例6: sendRequest

 /**
  * Function to send the request to the remote API
  *
  * @return  \Trucker\Responses\Response
  */
 public function sendRequest()
 {
     try {
         $response = $this->request->send();
     } catch (\Guzzle\Http\Exception\BadResponseException $e) {
         $response = $e->getResponse();
     }
     if (Config::get('request.debug', false)) {
         echo 'Request Method: ' . $this->request->getMethod() . "\n";
         echo "Body: " . $response->getBody() . "\n";
         echo "Status Code: " . $response->getStatusCode() . "\n";
         echo "URL: " . $this->request->getUrl() . "\n\n";
     }
     return $this->app->make('trucker.response')->newInstance($this->app, $response);
 }
开发者ID:victormacko,项目名称:trucker,代码行数:20,代码来源:RestRequest.php

示例7: generateAuthHeader

 private function generateAuthHeader(Request $request, $timestamp, $nonce)
 {
     $url = $request->getUrl();
     $hash = $this->getSHA1(md5(self::$consumer_secret), $this->urlencode($url));
     $headers = ['OAuth realm' => ''];
     $headers[self::$keys['OAuthVersionKey']] = self::$oAuthVersion;
     $headers[self::$keys['OAuthTimestampKey']] = $timestamp;
     $headers[self::$keys['OAuthNonceKey']] = $nonce;
     $headers[self::$keys['OAuthSignatureMethodKey']] = 'HMAC-SHA1';
     $headers[self::$keys['OAuthConsumerKeyKey']] = self::$consumer_key;
     $headers[self::$keys['OAuthSignatureKey']] = $hash;
     $h = [];
     foreach ($headers as $name => $value) {
         $h[] = $name . '="' . $value . '"';
     }
     return implode(',', $h);
 }
开发者ID:wisembly,项目名称:semantria-php,代码行数:17,代码来源:SemantriaAuthClient.php

示例8: send

 private function send(Request $request)
 {
     try {
         $this->logger and $this->logger->debug(sprintf('%s "%s"', $request->getMethod(), $request->getUrl()));
         $this->logger and $this->logger->debug(sprintf("Request:\n%s", (string) $request));
         $response = $this->client->send($request);
         $this->logger and $this->logger->debug(sprintf("Response:\n%s", (string) $response));
         return $response;
     } catch (ClientErrorResponseException $e) {
         $this->logException($e);
         $statusCode = $e->getResponse()->getStatusCode();
         $reasonPhrase = $e->getResponse()->getReasonPhrase();
         $message = sprintf('The request is not valid (status code: "%d", reason phrase: "%s").', $statusCode, $reasonPhrase);
         throw new ApiClientException($message, 0, $e);
     } catch (BadResponseException $e) {
         $this->logException($e);
         throw new ApiServerException('Something went wrong with upstream.', 0, $e);
     }
 }
开发者ID:puwenhan,项目名称:twitter-sdk,代码行数:19,代码来源:Twitter.php

示例9: printLastResponseOnError

 /**
  * @AfterScenario
  */
 public function printLastResponseOnError(BaseScenarioEvent $scenarioEvent)
 {
     if ($scenarioEvent->getResult() == StepEvent::FAILED) {
         if ($this->response) {
             $body = $this->getResponse()->getBody(true);
             // could we even ask them if they want to print out the error?
             // or do it based on verbosity
             // print some debug details
             $this->printDebug('');
             $this->printDebug('<error>Failure!</error> when making the following request:');
             $this->printDebug(sprintf('<comment>%s</comment>: <info>%s</info>', $this->lastRequest->getMethod(), $this->lastRequest->getUrl()) . "\n");
             if ($this->response->isContentType('application/json') || $this->response->isContentType('+json')) {
                 $data = json_decode($body);
                 if ($data === null) {
                     // invalid JSON!
                     $this->printDebug($body);
                 } else {
                     // valid JSON, print it pretty
                     $this->printDebug(json_encode($data, JSON_PRETTY_PRINT));
                 }
             } else {
                 // the response is HTML - see if we should print all of it or some of it
                 $isValidHtml = strpos($body, '</body>') !== false;
                 if ($this->useFancyExceptionReporting && $isValidHtml) {
                     $this->printDebug('<error>Failure!</error> Below is a summary of the HTML response from the server.');
                     // finds the h1 and h2 tags and prints them only
                     $crawler = new Crawler($body);
                     foreach ($crawler->filter('h1, h2')->extract(array('_text')) as $header) {
                         $this->printDebug(sprintf('        ' . $header));
                     }
                 } else {
                     $this->printDebug($body);
                 }
             }
         }
     }
 }
开发者ID:rllmwm,项目名称:forbiddencat,代码行数:40,代码来源:ApiFeatureContext.php

示例10: deEncodeRequestUrl

 /**
  * 
  * @param \Guzzle\Http\Message\Request $request
  * @return \Guzzle\Http\Message\Request
  */
 private function deEncodeRequestUrl(\Guzzle\Http\Message\Request $request)
 {
     // Intentionally not a one-liner to make the process easier to understand
     $requestUrl = $request->getUrl(true);
     $requestQuery = $requestUrl->getQuery(true);
     $requestQuery->useUrlEncoding(false);
     $requestUrl->setQuery($requestQuery);
     $request->setUrl($requestUrl);
     return $request;
 }
开发者ID:webignition,项目名称:url-resolver,代码行数:15,代码来源:Resolver.php

示例11: setRequestCookies

 /**
  * 
  * @param \Guzzle\Http\Message\Request $request
  */
 private function setRequestCookies(\Guzzle\Http\Message\Request $request)
 {
     if (!is_null($request->getCookies())) {
         foreach ($request->getCookies() as $name => $value) {
             $request->removeCookie($name);
         }
     }
     $cookieUrlMatcher = new \webignition\Cookie\UrlMatcher\UrlMatcher();
     foreach ($this->getConfiguration()->getCookies() as $cookie) {
         if ($cookieUrlMatcher->isMatch($cookie, $request->getUrl())) {
             $request->addCookie($cookie['name'], $cookie['value']);
         }
     }
 }
开发者ID:webignition,项目名称:website-rss-feed-finder,代码行数:18,代码来源:WebsiteRssFeedFinder.php

示例12: getUrl

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

示例13: processSuccessfulRequest

 /**
  * @param Request $request
  * @param string  $body
  */
 private function processSuccessfulRequest(Request $request, $body)
 {
     $response = $request->getResponse();
     $headers = $request->getHeaders()->getAll();
     $responseBody = $response->getBody(true);
     $status = $response->getStatusCode();
     $this->lastRequest['response']['body'] = $responseBody;
     $this->lastRequest['response']['status'] = $status;
     $this->logRequestSuccess($request->getMethod(), $request->getUrl(), $body, $headers, $status, $responseBody, $response->getInfo('total_time'));
 }
开发者ID:security-geeks,项目名称:squert,代码行数:14,代码来源:GuzzleConnection.php

示例14: signRequest

 /**
  * Adds "key" parameters as a Query Parameter
  *
  * @param Request $request
  */
 protected function signRequest($request)
 {
     $url = $request->getUrl(true);
     $url->getQuery()->add('key', $this->key);
     $request->setUrl($url);
 }
开发者ID:opdavies,项目名称:nwdrupalwebsite,代码行数:11,代码来源:KeyAuthPlugin.php

示例15: testCanRetrieveUrlObject

 /**
  * @covers Guzzle\Http\Message\Request
  */
 public function testCanRetrieveUrlObject()
 {
     $request = new Request('GET', 'http://www.example.com/foo?abc=d');
     $this->assertInstanceOf('Guzzle\\Http\\Url', $request->getUrl(true));
     $this->assertEquals('http://www.example.com/foo?abc=d', $request->getUrl());
     $this->assertEquals('http://www.example.com/foo?abc=d', (string) $request->getUrl(true));
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:10,代码来源:RequestTest.php


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