Sample code for 30+ languages & platforms
PHP

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\Cert;

$cert = new Cert();
try {
    $cert->LoadByCommonName('Chilkat Software, Inc.');
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\n";
    exit;
}

echo $cert->SubjectDN, "\n";
echo "Success.\n";