diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-07-02 03:32:46 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-07-02 03:32:46 +0300 |
commit | 8daccb2ef9551f231f9be32c3dd3731fdb1a96a8 (patch) | |
tree | 955656d6a3204847b616681854d00fcc326176dd /src/ssl_expire_notifier.php | |
parent | 4c69cf585b42f11d7861db56b098c0ac0d5b46c3 (diff) |
handle connection failure
Diffstat (limited to 'src/ssl_expire_notifier.php')
-rwxr-xr-x | src/ssl_expire_notifier.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ssl_expire_notifier.php b/src/ssl_expire_notifier.php index 5f01bcc..19b0dca 100755 --- a/src/ssl_expire_notifier.php +++ b/src/ssl_expire_notifier.php @@ -104,6 +104,11 @@ function ssl_expire_notifier() { ] ]); $read = stream_socket_client('ssl://'.$host.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $get); + if ($read === false) { + $logger->error("failed to connect to {$host}:{$port}"); + continue; + } + $cert = stream_context_get_params($read); $cert_info = openssl_x509_parse($cert['options']['ssl']['peer_certificate']); |