duanjuelu8874 2015-01-21 11:43
浏览 1330

如何在Guzzle 5中忽略无效的SSL证书错误

This should be an easy thing to do. I can find plenty of references to how to do it in Guzzle 3, but they don't work in Guzzle 5.

What I am doing so far:

$this->client = new GuzzleClient(['defaults' => [
    'verify' => 'false'
]]);

When I send a request though I get this error:

RequestException in RequestException.php line 51:
SSL CA bundle not found: false

I cannot find any useful reference to this error on google. If I could get access to the curl options then I could try something like the solution suggested here (which is for Guzzle 3, hence why it doesn't work): http://inchoo.net/dev-talk/symfony2-guzzle-ssl-self-signed-certificate/, the relevant section of which is:

$req->getCurlOptions()->set(CURLOPT_SSL_VERIFYHOST, false);
$req->getCurlOptions()->set(CURLOPT_SSL_VERIFYPEER, false);
  • 写回答

3条回答 默认 最新

  • dqwd71332 2015-02-21 19:22
    关注

    You should use

    $this->client = new GuzzleClient(['defaults' => [
        'verify' => false
    ]]);
    

    i.e. a Boolean false, not the string 'false'

    The documentation is here: http://guzzle.readthedocs.org/en/latest/clients.html#verify

    评论

报告相同问题?

悬赏问题

  • ¥15 用三极管设计—个共射极放大电路
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示