With Guzzle HTTP client I know you can set new GuzzleClient(['verify' => false])
to have it not check the certificate, eg. when you are using a self-signed certificate. But how can I make it accept and trust a specific self-signed certificate, so that you don't just open up for ANY certificate but only one specific one - is that possible?
让Guzzle信任自签名证书?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- dongmaomou4117 2019-04-12 11:49关注
A self-signed certificate is its own authority, so simply set the verify option to the filename of the certificate:
// Use a custom SSL certificate on disk. new GuzzleClient(['verify' => '/path/to/self-signed/cert.pem']);
http://docs.guzzlephp.org/en/stable/request-options.html#verify-option
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报