Sample code for 30+ languages & platforms
PHP Extension

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$success = false;

$http = new CkHttp();
$cert = new CkCert();

$success = $http->GetServerCert('chilkatsoft.com',443,$cert);
if ($success == false) {
    print $http->lastErrorText() . "\n";
    exit;
}

print $cert->subjectDN() . "\n";
print $cert->validToStr() . "\n";

// Output:

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

?>