采集时报错cURL error 60: SSL certificate problem [ 2.0 版本 ]
https://github.com/FriendsOfPHP/Goutte
之前用下面代码采集时
namespace backend\controllers;
use Yii;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use Goutte\Client;
/**
*
*/
class CrawlerController extends BackendController
{
public function actionIndex(){
$client = new Client();
$crawler = $client->request('GET', 'https://movie.douban.com/subject_search?search_text=
%E7%BE%8E%E5%A5%B3&cat=1002');
$crawler->filter('li')->each(function ($node) {
echo '<pre>';
print_r($node)."<br>";
});
}
}
报错 cURL error 60: SSL certificate problem: unable to get local issuer certificat
最后配置了下php.ini文件
curl.cainfo = "D:\AppServ\php5\cacert.pem" //这里填写自己对应的路径
并去拷贝了下面链接的代码,自己建了个文件在上面的路径上,文件名就是cacert.pem
https://curl.haxx.se/ca/cacert.pem
重启apache,之后ok拉!
沐风待雨 shenzhen
注册时间:2015-01-07
最后登录:2018-03-03
在线时长:16小时22分
最后登录:2018-03-03
在线时长:16小时22分
- 粉丝8
- 金钱350
- 威望50
- 积分1010
共 2 条评论
路过看看!
谢谢撸猪,刚刚解决,six six six