PHP code example of tal7aouy / sslchecker

1. Go to this page and download the library: Download tal7aouy/sslchecker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tal7aouy / sslchecker example snippets




use Tal7aouy\SSLChecker\SSLChecker;

$checker = new SSLChecker();


$expiryDates = $checker->checkExpiry('example.com');


Array
(
    [valid_from] => 2022-01-01 00:00:00
    [valid_until] => 2023-01-01 00:00:00
)


$checker = new SSLChecker();

try {
    $expiryDates = $checker->checkExpiry('example.com');
    echo 'SSL certificate for example.com is valid from ' . $expiryDates['valid_from'] . ' to ' . $expiryDates['valid_until'] . PHP_EOL;
} catch (Exception $e) {
    echo 'Error checking SSL certificate: ' . $e->getMessage() . PHP_EOL;
}