首页 文章

卷曲错误SSL证书无法获得本地颁发者证书 - 最近的开发

提问于
浏览
14

我一直在使用cURL来验证几个月的登录,并且 it has been working fine.

$searchURL = "https://url.com/isTokenValid?";

$strCookie = 'asdf=' . $_COOKIE['asdf'] . '; path=/';    
$ch = curl_init();             
curl_setopt($ch, CURLOPT_URL, $searchURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);       
curl_setopt( $ch, CURLOPT_COOKIE, $strCookie ); 
curl_setopt($ch, CURLOPT_CAPATH, "\cacert.pem");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, FALSE);

if($answer = curl_exec($ch))
{        
  if (strpos($answer,'true') !== false) 
  {
    $login = true;
  }
  else
  {
    $login = false;
  }

今天早上 - 它停止工作,我收到错误:

卷曲错误:SSL证书问题:无法获得本地颁发者证书

我正在使用https://curl.haxx.se/ca/cacert.pem中的 cacert.pem 文件 - 如果需要以某种方式更新或刷新此数据,我使用此日期的文件,这似乎仍然是最新的:

Mozilla的证书数据截至:2015年10月28日星期三04:12:04

这不是我在网络开发方面的强项,所以我不确定如何解决这里发生的事情 . 我的第一个想法是它必须是服务器端的东西,因为我周末没有在本地进行任何更改,但我不想开始戳,如果有人能指出我正确的方向 .

谢谢!

2 回答

  • 1

    下载https://curl.haxx.se/ca/cacert.pem并重命名为ssl.txt,然后你可以试试

    $ch = curl_init();
     curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, TRUE); 
     curl_setopt ($ch, CURLOPT_CAINFO, dirname(__FILE__)."/ssl.txt");
    
  • 0

    男子卷曲状态:

    -k, --insecure
              (SSL)  This  option explicitly allows curl to perform "insecure"
              SSL connections and transfers. All SSL connections are attempted
              to  be  made secure by using the CA certificate bundle installed
              by default. This makes  all  connections  considered  "insecure"
              fail unless -k, --insecure is used.
    
              See     this    online    resource    for    further    details:
              http://curl.haxx.se/docs/sslcerts.html
    

相关问题