Zend framework2 ZF2 Http请求问题
我在想我是否遗漏了什么Zend framework2 ZF2 Http请求问题,zend-framework2,Zend Framework2,我在想我是否遗漏了什么 [statusCode:protected] => 200 [reasonPhrase:protected] => OK [version:protected] => 1.1 [headers:protected] => Zend\Http\Headers Object ( [pluginClassLoader:protected] => [headersKeys:protected] => A
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
我的第一个代码:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlParam->asXML());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300);
$data = curl_exec($ch);
curl_close($ch);
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
这工作正常
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
第二个代码:
$client = new Client($url, array(
'maxredirects' => 0,
'timeout' => 30,
'adapter' => 'Zend\Http\Client\Adapter\Curl'));
$client->setMethod("POST");
$client->setRawBody($xmlParam->asXML());
$client->setEncType('text/xml');
$response = $client->send();
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
这就是问题所在
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
来自第二组代码的错误
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
Zend\Http\Response对象(
[推荐原因短语:受保护]=>阵列
(
[100]=>继续
[101]=>交换协议
[102]=>处理
[200]=>正常
[201]=>已创建
[202]=>已接受
[203]=>非权威信息
[204]=>没有内容
[205]=>重置内容
[206]=>部分内容
[207]=>多状态
[208]=>已报告
[300]=>多项选择
[301]=>永久移动
[302]=>找到
[303]=>请参阅其他
[304]=>未修改
[305]=>使用代理
[306]=>交换机代理
[307]=>临时重定向
[400]=>错误的请求
[401]=>未经授权
[402]=>需要付款
[403]=>禁止
[404]=>未找到
[405]=>不允许使用的方法
[406]=>不可接受
[407]=>需要代理身份验证
[408]=>请求超时
[409]=>冲突
[410]=>消失了
[411]=>所需长度
[412]=>预处理失败
[413]=>请求实体太大
[414]=>请求URI太大
[415]=>不支持的媒体类型
[416]=>请求的范围不可满足
[417]=>预期失败
[418]=>我是个茶壶
[422]=>无法处理的实体
[423]=>已锁定
[424]=>失败的依赖项
[425]=>无序收集
[426]=>需要升级
[428]=>需要先决条件
[429]=>请求太多
[431]=>请求标头字段太大
[500]=>内部服务器错误
[501]=>未实施
[502]=>坏网关
[503]=>服务不可用
[504]=>网关超时
[505]=>不支持HTTP版本
[506]=>变体也进行协商
[507]=>存储不足
[508]=>检测到循环
[511]=>需要网络身份验证
)
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
@B� ���我���
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
这不是一个错误,而是一个Zend\Http\Response对象,当您调用send方法时,客户端对象会返回该对象
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
您可以从发布的输出中看到它已成功返回(Http 200响应)
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
并返回了一些压缩的内容
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
[content:protected] => ���...
您只需拨打:
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
$response->getBody();
它将返回响应的解码内容体
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��
有关更多详细信息,请参阅
[statusCode:protected] => 200
[reasonPhrase:protected] => OK
[version:protected] => 1.1
[headers:protected] => Zend\Http\Headers Object
(
[pluginClassLoader:protected] =>
[headersKeys:protected] => Array
(
[0] => cachecontrol
[1] => pragma
[2] => contenttype
[3] => contentencoding
[4] => vary
[5] => server
[6] => xaspnetversion
[7] => xpoweredby
[8] => xframeoptions
[9] => xcontenttypeoptions
[10] => contentsecuritypolicy
[11] => date
[12] => connection
)
[headers:protected] => Array
(
[0] => Array
(
[name] => Cache-Control
[line] => Cache-Control: no-cache
)
[1] => Array
(
[name] => Pragma
[line] => Pragma: no-cache
)
[2] => Array
(
[name] => Content-Type
[line] => Content-Type: text/xml; charset=utf-8
)
[3] => Array
(
[name] => Content-Encoding
[line] => Content-Encoding: gzip
)
[4] => Array
(
[name] => Vary
[line] => Vary: Accept-Encoding
)
[5] => Array
(
[name] => Server
[line] => Server: Microsoft-IIS/8.5
)
[6] => Array
(
[name] => X-AspNet-Version
[line] => X-AspNet-Version: 4.0.30319
)
[7] => Array
(
[name] => X-Powered-By
[line] => X-Powered-By: ASP.NET
)
[8] => Array
(
[name] => X-Frame-Options
[line] => X-Frame-Options: DENY
)
[9] => Array
(
[name] => X-Content-Type-Options
[line] => X-Content-Type-Options: nosniff
)
[10] => Array
(
[name] => Content-Security-Policy
[line] => Content-Security-Policy: frame-ancestors 'none';
)
[11] => Array
(
[name] => Date
[line] => Date: Tue, 17 Jan 2017 12:09:01 GMT
)
[12] => Array
(
[name] => Connection
[line] => Connection: close
)
)
)
[metadata:protected] => Array
(
)
[content:protected] => ���`I�%&/m�{J�J��t��`$ؐ@������iG#)�*��eVe]f@�흼��{���{���;�N'���?\fdl��J�ɞ!���?~|?"��ez��MQ-?�hw��Q�/�լX^|�Ѻ=�>���8����uެ�e���i���e{t����տ�������^�GO�z��������������'oξ|���k��/��.�ߧZ�YY���:�g�y��m�-�l�z�U���v���=M��U]]�|��