Swoole\Coroutine\Client->getPeerCert()

Notice: ext-swoole is supported until v4.7.1, use ext-openswoole >= v4.7.1. Latest version: pecl install openswoole-4.9.1

Declaration

<?php
Swoole\Coroutine\Client->getPeerCert(): string|false

Parameters

None

Return

When successful, it returns X509 certificate information, when it fails it returns false

Description

Obtain server-side certificate information.

This method can only be used once SSL has been completed and the handshake is successful.

The function openssl_x509_parse which is provided by the OpenSSL library can be used to parse the certificate information.

You must have installed Swoole using --enable-openssl for this to work.