gpt4 book ai didi

php - curl_getinfo($ch, CURLINFO_CERTINFO) 为空

转载 作者:太空宇宙 更新时间:2023-11-03 13:20:33 27 4
gpt4 key购买 nike

我有来自 IUS 的 PHP 7.2存储库,但相同的行为是在默认的 PHP (CentOS 7.x) 上。

代码:

$domain = "google.com";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://' . $domain);
curl_setopt($ch, CURLOPT_CERTINFO, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);

curl_exec($ch);
$certInfo = curl_getinfo($ch, CURLINFO_CERTINFO);

curl_close($ch);

变量 $certInfo 为空。我用 https://www.howsmyssl.com/a/check 测试了 curl并且它支持 TLS 1.2。

OpenSSL 1.0.2k-fips
cURL support => enabled
cURL Information => 7.29.0
Age => 3
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => Yes
IDN => Yes
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => No
SSL => Yes
SSPI => No
TLS-SRP => No
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smtp, smtps, telnet, tftp
Host => x86_64-redhat-linux-gnu
SSL Version => NSS/3.36
ZLib Version => 1.2.7
libSSH Version => libssh2/1.4.3

怎么了? curl ?打开SSL? NSS?

最佳答案

试试这个:(更新域)

$domain = "www.google.com";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://' . $domain);
curl_setopt($ch, CURLOPT_CERTINFO, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_VERBOSE, 1);

curl_exec($ch);
$certInfo = curl_getinfo($ch, CURLINFO_CERTINFO);

curl_close($ch);

关于php - curl_getinfo($ch, CURLINFO_CERTINFO) 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54816102/

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