本文整理汇总了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;
}
示例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());
}
示例3: processGuzzleResponse
protected function processGuzzleResponse(Response $response)
{
$this->processResponseHeaders($response->getRawHeaders());
$this->processResponseBody($response->getBody(true));
}
示例4: getRawHeaders
/**
* {@inheritdoc}
*/
public function getRawHeaders()
{
return $this->response->getRawHeaders();
}