laravel curl证书失效报错解决方法

Laravel框架
463
0
0
2022-04-10

Laravel使用curl抓取网页时,如果对方网站域名证书过期,就会出现以下报错:

 cURL error 60: SSL certificate problem: certificate has expired (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

解决方法也非常简单,把证书校验关闭就行,Laravel的Curl类 Illuminate\Support\Facades\Http里调用下这个方法 withoutVerifying

Http::withoutVerifying()->...