How to ignore invalid SSL certificate errors in Guzzle 5 How to ignore invalid SSL certificate errors in Guzzle 5 curl curl

How to ignore invalid SSL certificate errors in Guzzle 5


You should use

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

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

The documentation is here:https://docs.guzzlephp.org/en/5.3/clients.html#verify

Note: a few people have given other answers that apply to Guzzle 6+. They're good answers if you are using those versions (but the original question was explicitly about Guzzle 5).


Try with updated version that works:

$this->client = new GuzzleClient(['base_uri' => 'https://api.example.com/', 'verify' => false ]);

or a more simple version:

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

Tested with version 6.2-dev.


The actual version is the correct one:

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

At 2018, this does not work:

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