sslinfo/index.php
2016-03-04 22:32:11 +01:00

18 lines
614 B
PHP

<?php
require("settings.php");
foreach ($sites as $s) {
$g = stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
$r = stream_socket_client("ssl://" . $s . ":443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $g);
$p = stream_context_get_params($r);
$c = openssl_x509_parse($p["options"]["ssl"]["peer_certificate"]);
$out = $s . " - " . date("Y-m-d H:i:s",$c["validTo_time_t"]);
if ($c["validTo_time_t"] < strtotime("+1 week")) {
print("<font color=\"red\"><b>" . $out . "</b></font><br>");
} else if (isset($_GET["debug"])) {
print($out . "<br>");
};
};