Sample code for 30+ languages & platforms
Perl 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 Perl Downloads

Perl
use chilkat();

$success = 0;

$http = chilkat::CkHttp->new();
$domain = "chilkatsoft.com";
$port = 443;

#  ------------------------------------------------------------------------
#  The GetServerSslCert method is deprecated:

# cert1 is a Cert
$cert1 = $http->GetServerSslCert($domain,$port);
if ($http->get_LastMethodSuccess() == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}

print $cert1->subjectDN() . "\r\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 = chilkat::CkCert->new();
$success = $http->GetServerCert($domain,$port,$cert2);
if ($success == 0) {
    print $http->lastErrorText() . "\r\n";
    exit;
}

print $cert2->subjectDN() . "\r\n";