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

Transition from Cert.ExportPublicKey to Cert.GetPublicKey

Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$success = false;

$cert = new CkCert();

//  ------------------------------------------------------------------------
//  The ExportPublicKey method is deprecated:

// publickeyObj is a CkPublicKey
$publickeyObj = $cert->ExportPublicKey();
if ($cert->get_LastMethodSuccess() == false) {
    print $cert->lastErrorText() . "\n";
    exit;
}

//  ...
//  ...

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

$publickeyOut = new CkPublicKey();
$success = $cert->GetPublicKey($publickeyOut);
if ($success == false) {
    print $cert->lastErrorText() . "\n";
    exit;
}


?>