微信调用企业付款报错OpenSSL error error:0906D06C?
发布于 6 年前 作者 leizhao 14569 次浏览 来自 官方Issues

在做微信的企业付款到零钱的时候报错

这是什么原因呢?是证书路径的问题吗?

我把证书放到根目录下 还是不行,求大神帮忙解决下,谢谢了

3 回复
// post https请求,CURLOPT_POSTFIELDS xml格式
function curl_post_ssl($url, $vars, $second = 30, $aHeader = array())
{
    $ch = curl_init();
    //超时时间
    curl_setopt($ch, CURLOPT_TIMEOUT, $second);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //这里设置代理,如果有的话
    //curl_setopt($ch,CURLOPT_PROXY, '10.206.30.98');
    //curl_setopt($ch,CURLOPT_PROXYPORT, 8080);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
 
    //以下两种方式需选择一种
 
    //第一种方法,cert 与 key 分别属于两个.pem文件
    //默认格式为PEM,可以注释
    curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
    curl_setopt($ch, CURLOPT_SSLCERT, getcwd() . '/public/apiclient_cert.pem');//本地用
//        curl_setopt($ch, CURLOPT_SSLCERT, './public/apiclient_cert.pem');//服务器用
    //默认格式为PEM,可以注释
    curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');
    curl_setopt($ch, CURLOPT_SSLKEY, getcwd() . '/public/apiclient_key.pem');//本地用
//        curl_setopt($ch, CURLOPT_SSLKEY, './public/apiclient_key.pem');//服务器用
 
    //第二种方式,两个文件合成一个.pem文件
//        curl_setopt($ch,CURLOPT_SSLCERT,getcwd().'/all.pem');
 
    if (count($aHeader) >= 1) {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $aHeader);
    }
 
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
    $data = curl_exec($ch);
    if ($data) {
        curl_close($ch);
        return $data;
    } else {
        $error = curl_errno($ch);
        echo "call faild, errorCode:$error\n";
        curl_close($ch);
        return false;
    }
}

试试这个

已经好了了 谢谢各位

看到thinkphp就烦!个人原因,勿喷

回到顶部