我有一个 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);
这里是 $curl_info 的 print_r:
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
)
非常感谢您的帮助!!
POPMUISE
白衣非少年