guzzle 发起 https 请求 报错解决方法

时间:2020-05-03 16:51:28   收藏:0   阅读:204

guzzle 发起http请求与https请求的区别,发起https请求时,需要在构造函数中传入一个配置项,

具体代码如下:

 //发起请求
        $client = new Client([‘timeout‘ => 5, ‘verify‘ => false]);

        $response=$client->get($url,);
        $body = (string)$response->getBody();
        $arr = json_decode($body, true);

这个配置项就是,‘verify‘=>false  ,添加此配置项  即不检查  ssl证书。

原文:https://www.cnblogs.com/zqblog1314/p/12822101.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!