大佬教程收集整理的这篇文章主要介绍了php批量检查https证书有效期,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
function get_cert_info($domain){ $context = stream_context_create(['ssl' => [ 'capture_peer_cert' => true, 'capture_peer_cert_chain' => true, ], ]); $client = stream_socket_client("ssl://".$domain.":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context); if($client==falsE) { return false; } $params = stream_context_get_params($client); $cert = $params['options']['ssl']['peer_certificate']; $cert_info = openssl_x509_parse($cert); return $cert_info; }
$domain = 'www.baidu.com'; $cert_info = get_cert_info($domain); $validTo_time_t = $cert_info['validTo_time_t']; $validTo_time_d = date('Y-m-d H:i:s', $validTo_time_t); echo($validTo_time_d);
以上是大佬教程为你收集整理的php批量检查https证书有效期全部内容,希望文章能够帮你解决php批量检查https证书有效期所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。