當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Browser::getLastRequest方法代碼示例

本文整理匯總了PHP中Buzz\Browser::getLastRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP Browser::getLastRequest方法的具體用法?PHP Browser::getLastRequest怎麽用?PHP Browser::getLastRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Buzz\Browser的用法示例。


在下文中一共展示了Browser::getLastRequest方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getLastRequest

 public function getLastRequest()
 {
     if ($this->fromCache) {
         return $this->data['request'];
     }
     return parent::getLastRequest();
 }
開發者ID:ivoba,項目名稱:buzzle,代碼行數:7,代碼來源:Browser.php

示例2: echoLastRequest

 /**
  * @Then /^echo last request$/
  *
  * Echos the last request for debugging purposes
  * -
  * Example:
  * And echo last request
  */
 public function echoLastRequest()
 {
     $request = $this->client->getLastRequest();
     echo sprintf("%s %s%s HTTP/%s\n", $request->getMethod(), $request->getHost(), $request->getResource(), $request->getProtocolVersion());
     $headerString = '';
     foreach ($request->getHeaders() as $header) {
         $headerString = sprintf("%s%s\n", $headerString, $header);
     }
     echo rtrim($headerString, "\n");
     if (empty($request->getContent()) === false) {
         echo sprintf("\nContent: %s", $request->getContent());
     }
 }
開發者ID:kielabokkie,項目名稱:jsonapi-behat-extension,代碼行數:21,代碼來源:JsonApiContext.php

示例3: echoLastResponse

 /**
  * @Then /^echo last response$/
  * @return void
  */
 public function echoLastResponse()
 {
     $this->printDebug($this->client->getLastRequest() . "\n\n" . $this->response . "\n\n" . "access_token: " . $this->access_token);
 }
開發者ID:sourcefabric,項目名稱:newscoop,代碼行數:8,代碼來源:RestContext.php

示例4: fromUrl

 /**
  * Parse an url address, and fill up the basic metadata.
  *
  * @param  string                       $url
  * @param  \Buzz\Client\ClientInterface $client
  * @return \Yoozi\Miner\Extractor
  */
 public function fromUrl($url, HttpClientInterface $client = null)
 {
     $browser = new Browser($client);
     $response = $browser->get($url, $this->config->get('headers'));
     $request = $browser->getLastRequest();
     $this->metadata = array();
     foreach (array('url', 'host', 'domain', 'favicon') as $key) {
         $this->metadata[$key] = $this->{'get' . studly_case($key)}($request);
     }
     if ($response->isSuccessful()) {
         $this->document = $response->getContent();
         $this->charset = $response->getHeaderAttribute('Content-Type', 'charset');
     }
     return $this;
 }
開發者ID:yoozi,項目名稱:golem,代碼行數:22,代碼來源:Extractor.php


注:本文中的Buzz\Browser::getLastRequest方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。