我有一个使用 cURL(最新版本)连接到安全网关进行支付的站点。
问题是 cURL 总是返回 0 长度的内容。我只得到标题。并且仅当我将 cURL 设置为返回标头时。我有以下标志。
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $gatewayURI);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POST, 1);
返回的标头是
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Tue, 25 Nov 2008 01:08:34 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Content-Length: 0
Content-Type: text/html
Set-Cookie: ASPSESSIONIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx; path=/
Cache-control: private
我也尝试过卷曲不同的网站,它们返回的内容很好。我认为这个问题可能与 https 连接有关。
我已经和公司谈过了,他们没有帮助。
有没有其他人遇到过这个错误并且知道解决方法?我应该放弃 cURL 并尝试使用fsockopen()
吗?
谢谢你。:)