php cUrl POST SSL 证书以错误 500 结尾

php cUrl POST with SSL certificate end with an error 500

我有一个 PHP cUrl 会话,它适用于 HTTP URL,但以 https 错误 500 结束...

我已经尝试使用

curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);

但是没用。

这是我的代码:

$ch= curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");  
curl_setopt($ch, CURLOPT_POSTFIELDS, $responseJson);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($responseJson))                                                                       
);
$output=curl_exec($ch);
$curl_info = curl_getinfo($ch);
curl_close($ch);

这里是 print_r 的 $curl_info:

Array
(
    [url] => https://xxx
    [content_type] => text/html; charset=utf-8
    [http_code] => 500
    [header_size] => 291
    [request_size] => 280
   [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0.474033
    [namelookup_time] => 0.004676
    [connect_time] => 0.005514
    [pretransfer_time] => 0.021116
    [size_upload] => 3082
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 6501
    [download_content_length] => 0
    [upload_content_length] => 3082
    [starttransfer_time] => 0.022492
    [redirect_time] => 0
    [redirect_url] => 
    [primary_ip] => xxx
    [certinfo] => Array
        (
        )

    [primary_port] => xxx
    [local_ip] => xxx
    [local_port] => xxx
)

非常感谢您的帮助!!

A 500 error is a generic error on the remote server, so probably nothing much that you can debug. You may need to contact the devs of the remote server to find out why their HTTPS site is giving a 500 error. – aynber

终于找到正确答案了。问题不在我的代码中,而是在服务器端。

感谢您为我指明了正确的方向!

我在 OpenSSL 站点上了解到某些版本尚不受支持。 php-5.6 或某些 CURL 版本之间也没有向后兼容性或兼容性。 我重新编译了一个不同版本的 openssl,这是他们的 LTS 程序。所有作品都完美无缺