繁体   English   中英

PHP CURL SSL连接到XML网关

[英]PHP CURL SSL Connecting to XML Gateway

这已经快把我逼疯了2天 - 我有两个PHP函数,详细使用curl双双跌破。 它们指向完全相同的“ XML网关”,唯一的区别是一个尝试通过SSL进行操作,另一个尝试通过未加密的HTTP进行操作。

HTTP连接器运算符完全按预期工作,发布XML文件并返回服务器响应。

SSL连接返回发生过如此含糊“内部服务器错误。 请稍后再试'。 我的lighttpd错误日志中什么都没有显示,有人有什么好主意吗?

我想知道这是否是我的Web服务器配置/ openSSL配置。 他们都是Debian的喘息标准封装。 我感谢SSL_VERIFYPEER&HOST设置为不安全出售,但是我一直在尝试穷尽所有选择。

openssl s_client -connect xmlgw.companieshouse.gov.uk:443 -ssl3

和命令行功能

curl https://xmlgw.companieshouse.gov.uk/v1-0/xmlgw/Gateway

也可以在Web服务器上按预期工作。

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;
}

任何帮助将非常感激!

谢谢

我已经得出结论,这是与服务器的整体连接中的错误-尽管我找不到任何证明方法。 我设法找到了不使用SSL套接字的替代解决方案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM