zoukankan      html  css  js  c++  java
  • Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed,SSL报错

    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&appid=".$this->AppId."&secret=".$this->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

  • 相关阅读:
    CentOS 7 安装java 环境
    CentOS 7 替换网易yum 源
    九度:题目1553:时钟
    Maximum Subarray
    职场细节
    poj2524 Ubiquitous Religions
    九度 1526:朋友圈
    程序载入
    设备管理
    操作系统系列
  • 原文地址:https://www.cnblogs.com/feimengv/p/4195195.html
Copyright © 2011-2022 走看看