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


PHP Response::getRawHeaders方法代码示例

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


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

示例1: __toString

 /**
  * Returns an HTML-formatted string representation of the exception.
  *
  * @return string
  * @internal
  */
 public function __toString()
 {
     $msg = $this->getMessage();
     if (is_object($this->requestObj) && $this->requestObj instanceof \Guzzle\Http\Message\Request) {
         $request = array('url' => $this->requestObj->getUrl(), 'host' => $this->requestObj->getHost(), 'headers' => $this->requestObj->getRawHeaders(), 'query' => (string) $this->requestObj->getQuery());
         if ($this->requestObj instanceof \Guzzle\Http\Message\EntityEnclosingRequestInterface) {
             $request_body = $this->requestObj->getBody();
             $request['content-type'] = $request_body->getContentType();
             $request['content-length'] = $request_body->getContentLength();
             $request['body'] = $request_body->__toString();
         }
         $msg .= "\n\nRequest: <pre>" . htmlspecialchars(print_r($request, true)) . '</pre>';
     }
     if (is_object($this->responseObj) && $this->responseObj instanceof \Guzzle\Http\Message\Response) {
         $response = array('status' => $this->responseObj->getStatusCode(), 'headers' => $this->responseObj->getRawHeaders(), 'body' => $this->responseBody);
         $msg .= "\n\nResponse: <pre>" . htmlspecialchars(print_r($response, true)) . '</pre>';
     }
     return $msg;
 }
开发者ID:nevetS,项目名称:flame,代码行数:25,代码来源:ResponseException.php

示例2: testGetRawHeaders

 /**
  * @covers Guzzle\Http\Message\Response::getRawHeaders
  */
 public function testGetRawHeaders()
 {
     $response = new Response(200, new Collection(array('Keep-Alive' => 155, 'User-Agent' => 'Guzzle', 'Content-Length' => 4)), 'body');
     $this->assertEquals("HTTP/1.1 200 OK\r\nKeep-Alive: 155\r\nUser-Agent: Guzzle\r\nContent-Length: 4\r\n\r\n", $response->getRawHeaders());
 }
开发者ID:KANU82,项目名称:guzzle,代码行数:8,代码来源:ResponseTest.php

示例3: processGuzzleResponse

 protected function processGuzzleResponse(Response $response)
 {
     $this->processResponseHeaders($response->getRawHeaders());
     $this->processResponseBody($response->getBody(true));
 }
开发者ID:sujata-patne,项目名称:api,代码行数:5,代码来源:Guzzle.php

示例4: getRawHeaders

 /**
  * {@inheritdoc}
  */
 public function getRawHeaders()
 {
     return $this->response->getRawHeaders();
 }
开发者ID:ramunasd,项目名称:platform,代码行数:7,代码来源:GuzzleRestResponse.php


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