如何解决如何解决Symfony / Goutte中的SSL问题
我正在尝试使用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".
这是代码:
use Goutte\Client;
$client = new 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');
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。