SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

 

            //获取token,页面地址为https://api.weixin.qq.com/cgi-bin/token
            curl_setopt($this->ch,CURLOPT_URL,"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&app>AppSecret);
            curl_setopt($this->ch,CURLOPT_RETURNTRANSFER,true);
            curl_setopt($this->ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($this->ch, CURLOPT_SSL_VERIFYHOST, false);

重点是上面加粗的两句话,可以解决问题。那么这两句什么意思呢?

1.CURLOPT_SSL_VERIFYPEER是做什么用的?
google了一下,它具体的作用就是去验证对方提供的(读取https)证书是否有效,过期,或是否通过CA颁发的!

那为什么在Windows下curl不工作,而linux下却工作的?
原来在Windows下,curl找不到CA证书去验证对方的证书!

2.

URLOPT_SSL_VERIFYHOST需要被设置成TRUE否则设置为FALSE

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2021-04-17
  • 2022-12-23
  • 2021-11-03
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2021-08-21
  • 2022-12-23
相关资源
相似解决方案