脚本宝典收集整理的这篇文章主要介绍了PHP Guzzle:空身反应,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
$client = new Client([ 'base_uri' => 'http://httpbin.org','timeout' => 2.0,]); $response = $client->request('GET','',['debug' => true]); var_dump($response->getBody()->getContents());
我得到的回应是:
* About to connect() to httpbin.org port 80 (#0) * Trying 23.22.14.18... * Connected to httpbin.org (23.22.14.18) port 80 (#0) > GET / HTTP/1.1 User-Agent: GuzzleHttp/6.2.0 curl/7.29.0 PHP/5.5.34 Host: httpbin.org HTTP/1.1 200 OK Server: Nginx Date: Mon,06 Jun 2016 06:48:13 GMT Content-tyPE: text/htML; charset=utf-8 Content-Length: 12150 Connection: keep-alive Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true * Connection #0 to host httpbin.org left intact string(0) ""
你可以看到正文是“”但内容长度是正确的.
"guzzlehttp/guzzle": "6.2","guzzlehttp/psr7": "1.3"
以上是脚本宝典为你收集整理的PHP Guzzle:空身反应全部内容,希望文章能够帮你解决PHP Guzzle:空身反应所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。