douchan6512 2012-12-21 10:28
浏览 554

在HTTPS站点上出现cURL错误60的可能原因是什么?

After scouring the web, I really am at my wit's end. I know this question has been asked several times but none of the solutions solve my problem. I'd like to know if there are any other known reasons for curl error 60: "SSL certificate problem, verify that the CA cert is OK".

I have set CURLOPT_CAINFO to the pem file (also tried crt) and I have checked for insufficient permissions when trying to access pem file.

Here's the code by the way:

$url = 'https://example.com/';

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 
curl_setopt($ch, CURLOPT_CAINFO, "/usr/local/apache2/htdocs/server/html/cacert.pem");

$response = curl_exec($ch);

...do something

curl_close($ch);
  • 写回答

1条回答 默认 最新

  • douzhi1924 2012-12-21 10:33
    关注

    You can try this:-

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, **'https://example.com/'**);
    // Set so curl_exec returns the result instead of outputting it.
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
    // Get the response and close the channel.
    $response = curl_exec($ch);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 opencv 无法读取视频
  • ¥15 用matlab 实现通信仿真
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图