gpt4 book ai didi

php - 下载 PEM 证书,但仍然得到 "unable to get local issuer certificate"

转载 作者:太空宇宙 更新时间:2023-11-03 14:55:51 25 4
gpt4 key购买 nike

我正在尝试创建一个代理服务器,我将在其中使用 curl 从 API 请求 JSON 对象。除了认证,我已经能够成功完成这项工作。

<?php
error_reporting(E_ALL);

$url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20csv%20where%20url%3D'http%3A%2F%2Ffinance.yahoo.com%2Fd%2Fquotes.csv%3Fs%3DMSFT%2BFFIV%26f%3Dnab'&format=json&diagnostics=true&callback=";

$ch = curl_init($url);

curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "\VeriSignClass3PublicPrimaryCertificationAuthority-G5.crt");
// Perform the request, and save content to $result
$result = curl_exec($ch);
if(curl_errno($ch)){
echo 'Curl error: ' . curl_error($ch);
} else {
echo $result;
}
exit();
?>

我已经下载了 yahooapis 认证 PEM 文件(带链和不带链)并将其放在与 proxy.php 文件相同的文件夹级别,但我仍然收到错误消息“无法获取本地颁发者证书” .

对可能遗漏的内容有什么想法吗?

此外,请不要建议将 CURLOPT_SSL_VERIFYPEER 设置为 false,因为我知道这会绕过验证。我需要服务器在连接之前进行验证。

谢谢!

最佳答案

curl_setopt($ch, CURLOPT_CAINFO, getcwd() . "\VeriSignClass3PublicPrimaryCertificationAuthority-G5.crt");

我不认为这是正确的。您需要 G3 而不是指纹为 74:2C:31:92:E6:07:E4:24:EB:45:49:54:2B:E1:BB:C5:3E:61:74 的 G5 证书: E2。由于 OpenSSL 与替代信任路径的问题,G5 证书将无法与 query.yahooapis.com 使用的设置一起使用 OpenSSL 堆栈。有关详细信息,请参阅 http://kriscience.blogspot.de/2013/03/supporting-trusted-but-untrusted.html .

关于php - 下载 PEM 证书,但仍然得到 "unable to get local issuer certificate",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29466166/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com