使用 cURL 读取 https 响应
我正在使用以下代码访问 URL(该 URL 使用 https 协议,并且具有有效的证书),
// Initialize session and set URL.
$url = https://my url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// Set so curl_exec returns the result instead of outputting it.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Get the response and close the channel.
$response = curl_exec($ch);
curl_close($ch);
但我得到的输出是这样的:
失败:错误号:60。原因:SSL 证书问题,请验证 CA证书没问题。详细信息:错误:14090086:SSL 例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败
有人可以指导我吗?
I am using the following code to access a URL (the URL uses the https protocol, and has a valid certificate)
// Initialize session and set URL.
$url = https://my url;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// Set so curl_exec returns the result instead of outputting it.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Get the response and close the channel.
$response = curl_exec($ch);
curl_close($ch);
But the output i get is this:
Failed: Error Number: 60. Reason: SSL certificate problem, verify that
the CA cert is OK. Details: error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Can somebody please guide me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用“CURLOPT_RETURNTRANSFER”
了解更多信息,请阅读此
use 'CURLOPT_RETURNTRANSFER'
for more info read this
尝试添加:
Try adding: