Sample code for 30+ languages & platforms
PHP Requires Chilkat v11.0.0+

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\Cert;
use Chilkat2\Http;

$http = new Http();
$cert = new Cert();

try {
    $http->GetServerCert('chilkatsoft.com', 443, $cert);
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\n";
    exit;
}

echo $cert->SubjectDN, "\n";
echo $cert->ValidToStr, "\n";

// Output:

// CN=*.chilkatsoft.com
// Wed, 10 Jun 2026 23:59:59 GMT