【发布时间】:2016-03-19 18:17:05
【问题描述】:
我在 laravel 做项目。我正在使用 plivo api 发送短信。为此,我遵循了
中提到的所有步骤https://www.plivo.com/docs/getting-started/send-a-single-sms/ 。
但是当我尝试运行我的 php 文件时,我收到了错误消息
“致命错误:未捕获的异常 'GuzzleHttp\Exception\RequestException' 带有消息 'cURL 错误 60:SSL 证书问题:证书链中的自签名证书(请参阅 http://curl.haxx.se/libcurl/c/libcurl-errors.html)' 在 G:\Xampp\htdocs\plivoTrial\ vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:187 堆栈跟踪:#0 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(150): GuzzleHttp\Handler\ CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory: :finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler \CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(对象(GuzzleHttp\Handler\CurlHandler), 对象(GuzzleHttp\Handler\EasyHandle), 对象(GuzzleHttp\Handler\CurlFactory)) #3 G:\Xampp \htdocs\plivoT ria 在 G:\Xampp\htdocs\plivoTrial\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php 第 187 行。
我的 php 文件看起来像,
<?php
require 'vendor/autoload.php';
use Plivo\RestAPI;
$auth_id = "xxxxxxxxxxxxx";
$auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$p = new RestAPI($auth_id, $auth_token);
// Set message parameters
$params = array(
'src' => 'xxxxxxxxxxx',
'dst' => '91xxxxxxxxxx',
'text' => 'Hi, I am Amarja :)',
'url' => 'http://localhost/untitled/sentsms.php',
'method' => 'POST'
);
// Send message
$response = $p->send_message($params);
echo "Response : ";
print_r ($response['response']);
echo "<br> Api ID : {$response['response']['api_id']} <br>";
echo "Message UUID : {$response['response']['message_uuid'][0]} <br>";
?>
我不知道如何解决这个问题。请帮助并提前非常感谢。
【问题讨论】:
-
有什么难理解的:证书链中的自签名证书(见curl.haxx.se/libcurl/c/libcurl-errors.html?
-
其实我之前做过同样的项目。这个新项目在旧项目所在的地方。那个旧项目运行完美,这就是为什么我没有得到问题所在....我认为问题可能与作曲家有关
-
在你的核心文件中试试
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); -
我在 Plivo 的 plivo.php 文件中试过这个,但仍然显示同样的错误。
-
是否可以在多个项目中使用auth id和auth token?