public static function getCommonName($X509Cert)
    {
        if (is_file($X509Cert)) {
            $handler = fopen($X509Cert, "r");
            $cert = fread($handler, 8192);
            fclose($handler);
        } else {
            $cert = $X509Cert;
        }

        $cert_as_array = openssl_x509_parse($cert);
        return $cert_as_array['subject']['CN'];
    }
public static function getCommonName($X509Cert)
    {
        if (is_file($X509Cert)) {
            $handler = fopen($X509Cert, "r");
            $cert = fread($handler, 8192);
            fclose($handler);
        } else {
            $cert = $X509Cert;
        }

        $cert_as_array = openssl_x509_parse($cert);
        return $cert_as_array['subject']['CN'];
    }
public static function getCommonName ( $ X509Cert ) { if ( is_file ( $ X509Cert ) ) { $ handler = fopen ( $ X509Cert , "r" ) ; $ cert = fread ( $ handler , 8192 ) ; fclose ( $ handler ) ; } else { $ cert = $ X509Cert ; } $ cert_as_array = openssl_x509_parse ( $ cert ) ; return $ cert_as_array [ 'subject' ] [ 'CN' ] ; }
Get the common name of the certificate

@param string $X509Cert Content or path of client public certificate
@return string
Get the common name of the certificate