Php 如何修复Symfony/Goutte中的SSL问题

Php 如何修复Symfony/Goutte中的SSL问题,php,symfony,goutte,Php,Symfony,Goutte,我正试图用Symfony/Goutte向网站提出请求,但我收到了这样的错误: In ErrorChunk.php line 65: SSL peer certificate or SSH remote key was not OK for "https://example.

我正试图用Symfony/Goutte向网站提出请求,但我收到了这样的错误:

In ErrorChunk.php line 65:
                                                                                                         
  SSL peer certificate or SSH remote key was not OK for "https://example.com".  
                                                                                                         
In CurlResponse.php line 298:
                                                                                                         
  SSL peer certificate or SSH remote key was not OK for "https://example.com".
代码如下:

使用痛风\客户端;
$client=新客户端();
$client->request('GET','https://example.com');

如何修复此问题?

您需要添加HttpClient并禁用SSL检查。。。(仅在调试时执行此操作)不在生产中

use Goutte\Client;
use Symfony\Component\HttpClient\HttpClient;

$client = new Client(HttpClient::create(['verify_peer' => false, 'verify_host' => false]));
$client->request('GET', 'https://example.com');

但是对于较新版本的Symfony,
Goutte\Client
中没有
setClient
方法更改为HttpClient。