简体   繁体   English

如何解决cURL错误60:Laravel 5中的SSL证书?

[英]How solve cURL error 60: SSL certificate in Laravel 5?

I'm using "FriendsOfPHP/Goutte" Package https://github.com/FriendsOfPHP/Goutte For web crawling... When I use "http://" links then it's ran correctly but when I use "https://" then show the following errors... 我正在使用“ FriendsOfPHP / Goutte”包https://github.com/FriendsOfPHP/Goutte用于网络抓取...当我使用“ http://”链接时,它将正确运行,但是当我使用“ https://”时, ”,然后显示以下错误...

2/2 RequestException in RequestException.php line 51: 2/2 RequestException在RequestException.php第51行:
cURL error 60: SSL certificate problem: unable to get local issuer certificate cURL错误60:SSL证书问题:无法获取本地颁发者证书

I think you have a certificate problem. 我认为您有证书问题。 It seems Goutte depends on Guzzle 4 . 看来Goutte靠的是“ Guzzle 4 And Guzzle can't find the proper certificate to verify a secure https request, see more about it here . 而且Guzzle找不到合适的证书来验证安全的https请求,请在此处查看有关证书的更多信息。

Try to download this file: Bundle of CA Root Certificates . 尝试下载此文件: CA根证书捆绑包 ( Open and Save As ). OpenSave As )。

Then locate your php.ini file and add,or edit if it already exists, this line 然后找到您的php.ini文件并添加或编辑此行(如果已存在)

curl.cainfo = "[pathtothisfile]\\cacert.pem"

Try disabling CURLOPT_SSL_VERIFYPEER to stop cURL from verifying the peer's certificate: 尝试禁用CURLOPT_SSL_VERIFYPEER以阻止cURL验证对等方的证书:

$client->getClient()
       ->setDefaultOption('config/curl/' . CURLOPT_SSL_VERIFYPEER, false);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM