为Apache启用OpenSSL 1.1.1 php
所有研究中心给予“1970-01-01”作为失效日期
<?php
$websites = $_POST['websites'];
$websites = explode(',', $websites);
foreach ($websites as $website) :
$website = trim($website);
$cert = openssl_x509_parse(file_get_contents("https://{$website}"));
$expiration = date('Y-m-d', $cert['validTo_time_t']);
echo "{$website}: {$expiration}<br>";
endforeach;
?>
任何研究中心给出相同的日期
1条答案
按热度按时间kcrjzv8t1#
将站点的内容(HTML)传递给openssl_x509_parse:
您需要证书对象或实际证书的内容
https://www.php.net/manual/en/function.openssl-x509-parse.php
有关示例,请参见:How to get SSL certificate info with CURL in PHP?。