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);

?>
时间: 2024-10-26 08:17:24

php SSL certificate problem: unable to get local issuer certificate的相关文章

curl: (60) SSL certificate problem: unable to get local issuer certificate 错误

今天同事做微信管理的项目,请求接口返回如下错误SSL certificate problem: unable to get local issuer certificate. 此问题的出现是由于没有配置信任的服务器HTTPS验证.默认,cURL被设为不信任任何CAs,就是说,它不信任任何服务器验证.因此,这就是浏览器无法通过HTTPs访问你服务器的原因. 解决此报错有2种处理方法 1.如果你的内容不敏感,一个快捷的方法是使用curl_exec()之前跳过ssl检查项. curl_setopt($

curl SSL certificate problem: unable to get local issuer certificate 错误的解决方法

报错信息为atal error: Uncaught exception 'Exception' with message 'SSL certificate problem: unable to get local issuer certificate' in......解决办法在php.ini 找到curl.cainfo = "d:/wamp/bin/php/php5.5.12/cacert.pem"证书下载地址: http://curl.haxx.se/ca/cacert.pem

...cURL error 60: SSL certificate problem: unable to get local issuer certificate...

问题描述: 在做PHP爬虫的时候, 安装了 guzzle 和 dom-crawler 之后, 调用的时候出现问题, 如下 报错内容: Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-

解决Twilio本地Postman请求时报错SSL certificate problem: unable to get local issuer certificate

http://www.shuijingwanwq.com/2018/02/28/2406/ https://curl.haxx.se/docs/caextract.html 编辑 php.ini,修改 ;curl.cainfo = 为 curl.cainfo = “C:\php-7.1.12\extras\ssl\cacert.pem” 原文地址:https://www.cnblogs.com/denghuachengle/p/11682209.html

cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

参考  http://blog.csdn.net/mazicwong/article/details/54946952 1.到https://curl.haxx.se/ca/cacert.pem复制下文本粘贴到文件夹cart.pem 然后把catr.pem放到php的bin目录下  我用的是phpstudy  应该放到D:\phpStudy\Apache\bin 目录 2. 在php.ini中修改下面这句话,把前面分号删掉,分号是省略,然后后面天上自己cacert.pem文件的路径,重启phps

cURL error 60: SSL certificate problem: unable to get local issuer certificate(转)【亲测】

php5.6以上的版本会出现这种问题 解决办法: [开启拓展] extension=curl extension=openssl [配置证书] 访问https://curl.haxx.se/docs/caextract.html,下载cacert.pem,并在php.ini文件添加 curl.cainfo="XXXXXXX/cacert.pem"   //配置相应的路径 openssl.cafile="XXXXXXX/cacert.pem"   //配置相应的路径

SSL certificate problem: unable to get local issue

今天在使用git克隆一个库的时候,报错如下: 正克隆到 'lepus'... fatal: unable to access 'https://github.com/ruzuojun/lepus.git/': SSL certificate problem: unable to get local issuer certificate 隐隐约约记得之前遇到过这种报错,但忘了解决办法,于是上网搜索一波.发现是https访问的的证书问题,我就使用命令直接去掉ssl的验证,问题解决. 解决方法: [[

php 发邮件报错unable to get local issuer certificate

发邮件的时候报错,邮件无法发送:SSL certificate: unable to get local issuer certificate 在Windows下,curl找不到CA证书去验证对方的证书! 方法一:(极度不推荐,不安全) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 方法二: It's easy to fix (php 5.3.7 or higher) - Download a list file with an up-to-d

GIT PUSH SSL certificate problem

https://blog.csdn.net/zenson_g/article/details/49148407 两天,不知道为什么,用Git提交代码到服务器时,总出现SSL certificate problem: unable to get local issuer certificate while accessing错误.在网上找了一下,发现解决的方法有以下几个: 方法一: 如果你是用命令行提交的,可以用以下命令设置临时环境变量GIT_SSL_NO_VERIFY. Windows下: se