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

Transition from Http.GetServerSslCert to Http.GetServerCert

See more HTTP Examples

Provides instructions for replacing deprecated GetServerSslCert method calls with GetServerCert.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

$http = new COM("Chilkat.Http");
$domain = 'chilkatsoft.com';
$port = 443;

//  ------------------------------------------------------------------------
//  The GetServerSslCert method is deprecated:

// cert1 is a Chilkat.Cert
$cert1 = $http->GetServerSslCert($domain,$port);
if ($http->LastMethodSuccess == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

print $cert1->SubjectDN . "\n";

//  ------------------------------------------------------------------------
//  Do the equivalent using GetServerCert.
//  Your application creates a new, empty certificate object which is passed 
//  in the last argument and filled with the server certificate upon success.

$cert2 = new COM("Chilkat.Cert");
$success = $http->GetServerCert($domain,$port,$cert2);
if ($success == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

print $cert2->SubjectDN . "\n";

?>