zoukankan      html  css  js  c++  java
  • php SSL certificate problem: unable to get local issuer certificate

    加上 

    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);

    就可以了

    百度语音的demo:

    <?php
    
    header("Content-type:audio/mp3; charset=utf-8");       
    
    //put your params here
    $cuid = "9619439";
    $apiKey = "gSwM3lYXkKXp5dDuU6zBjHrr";
    $secretKey = "ff9c651db48ac780c85eed057c593e89";
    
    $auth_url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id=".$apiKey."&client_secret=".$secretKey;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $auth_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
    $response = curl_exec($ch);
    if(curl_errno($ch))
    {
        print curl_error($ch);
    }
    curl_close($ch);
    $response = json_decode($response, true);
    $token = $response['access_token'];
    
    function double ($a) {
        return urlencode(urlencode($a));
    }
    
    $url = "http://tsn.baidu.com/text2audio?tex=".double('123')."&lan=".double('zh')."&cuid=".double($cuid)."&ctp=".double('1')."&tok=".double($token);
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($ch, CURLOPT_TIMEOUT, 30);
    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
    $response = curl_exec($ch);
    if(curl_errno($ch))
    {
        print curl_error($ch);
    }
    curl_close($ch);
    echo $response;
    $response = json_decode($response, true);
    var_dump($response);
    
    ?>
  • 相关阅读:
    使用Python创建TCP代理之工业时代造轮子
    CVE-2020-0796 SMB远程代码执行漏洞(分析、验证及加固)
    Oracle 找到引起账户锁定的IP
    【OGG 故障处理】OGG-01031
    【OGG 故障处理】OGG-01028
    【OGG 故障处理】 丢失归档恢复
    19C imp 导入合并表空间
    CentOS 7 配置VNCServer
    ORA-3136 问题处理
    HugePages概述--翻译自19C文档
  • 原文地址:https://www.cnblogs.com/CyLee/p/6828495.html
Copyright © 2011-2022 走看看