【发布时间】:2014-01-26 21:35:09
【问题描述】:
我正在尝试使用 php-ews-master 连接到 Exchange 服务器,但我一直在苦苦挣扎。
使用 CURL_HTTP_VERSION_1_1 我收到了错误:
- 分块编码数据中的问题 (3)。
如果我修改为 CURL_HTTP_VERSION_1_0 我收到了来自服务器的响应,但响应中有很多添加的字符(我想这些是因为分块响应???),因此它不是一个有效的 xml 文件。
我正在尝试使用的代码:
$headers = array(
'Method: POST',
'Connection: Keep-Alive',
'User-Agent: PHP-SOAP-CURL',
'Content-Type: text/xml; charset=utf-8',
'SOAPAction: "'.$action.'"',
);
$this->ch = curl_init($location);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, $this->validate);
curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, $this->validate);
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($this->ch, CURLOPT_POST, true );
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($this->ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($this->ch, CURLOPT_USERPWD, $this->user.':'.$this->password);*
$response = curl_exec($this->ch);
感谢您的帮助。
【问题讨论】:
标签: php curl libcurl soap-client