Ignore an SSL Certificate Error in Guzzle: Per-Request, Per-Client, or With a CA Bundle
Guzzle normally checks the server certificate and hostname before sending a request.
When that check fails, the request stops with an SSL error instead of returning a response. You have three practical paths: turn verification off for one call, turn it off for every call from a client, or keep verification on and supply a trusted CA bundle. The third option is the safest for anything beyond local testing.
What verify controls, and why it matters
Verification is on by default. Setting verify to false removes both the certificate check and the hostname check, leaving the connection exposed to man-in-the-middle attacks. Reserve that setting for local testing or a trusted self-signed certificate. Without it, a bad certificate produces a GuzzleHttp\Exception\RequestException whose message begins with cURL error 60: SSL certificate problem.
Turn verification off for one request
Pass verify as false in the options for that single call. The protected example code0001 does this against a self-signed test host and prints the HTTP status code. In the captured run it printed 200, showing the request completed once verification was disabled for that call only. Other requests through the same client keep normal validation.
Turn verification off for every request from a client
Put verify set to false in the client constructor instead, as shown in protected module code0002. Every request from that client then inherits the setting, and the captured run again printed 200. Because constructor values are defaults, a later per-request verify set to true re-enables checking for that individual call. Use this broader scope only when you intend all traffic from that client to skip validation.
Keep verification on with a custom CA bundle
Instead of disabling checks, give Guzzle a CA bundle it can trust. Protected module code0003 sets verify to a file path, so Guzzle validates the server certificate against that bundle. Replace the placeholder path with the real location of your trusted bundle and the placeholder URL with your server; a successful request prints its HTTP status code. A directory of certificates can also be used. If the path does not exist, Guzzle throws an InvalidArgumentException reading SSL CA bundle not found. For a general-purpose bundle, the cURL maintainer publishes the Mozilla CA bundle, and you can alternatively point the openssl.cafile setting in php.ini at a bundle on disk and leave verify out entirely.
Decision checklist
Choose per-request verify false when only one endpoint has a certificate problem and the rest of the client should stay protected. Choose client-wide verify false only for a short-lived test client where every destination is trusted. Choose a CA bundle path when you need validation to remain active, for example with an internal server using a private CA. Before shipping, search the codebase for verify set to false and confirm each remaining use is limited to local testing or a trusted self-signed certificate.