【发布时间】:2013-10-05 12:57:27
【问题描述】:
这已经让我发疯了 2 天 - 我有 2 个使用 curl 的 PHP 函数,如下所述。他们指向完全相同的“XML 网关”,唯一的区别是一个尝试通过 SSL 进行,另一个尝试通过未加密的 HTTP。
HTTP 连接器操作符完全按预期工作,发布 XML 文件并返回服务器响应。
SSL 连接器返回非常模糊的“发生内部服务器错误”。请稍后再试'。我的 lighttpd 错误日志中没有显示任何内容,有人有什么好主意吗?
我想知道这是否是我的网络服务器配置/openSSL 配置。它们都是 Debian Wheezy 标准软件包。我很欣赏 SSL_VERIFYPEER & HOST 设置销售是不安全的,但是我一直在尝试用尽这些选项。
openssl s_client -connect xmlgw.companieshouse.gov.uk:443 -ssl3
和命令行功能
curl https://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway
在网络服务器上也可以正常工作。
PHP 函数:
//SSL post function
public function getSSLCurlResponse($xml) {
$url = "https://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSLVERSION,3);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
//HTTP non SSL function
public function getCurlResponse($xml) {
$url = "http://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
任何帮助将不胜感激!
谢谢
【问题讨论】:
标签: php curl ssl debian lighttpd