SSL (Secure Sockets Layer Secure Socket Layer), and its successor Transport Layer Security (TLS), are a security protocol that provides security and data integrity for network communications. TLS and SSL encrypt network connections at the transport layer. This article introduces to you how to use PHP to view SSL certificate information. The article introduces it to you through pictures, texts and examples. Friends can refer to it if necessary. Let's take a look together.
Preface
SSL certificate complies with the SSL protocol and is issued by a trusted digital certificate authority CA after verifying the server's identity. It has server identity verification and data transmission. Encryption function. The following is an example of viewing SSL certificate information through PHP. You can take a look if you need it.
Sample code
<? $str = file_get_contents('2.cer'); print_r(openssl_x509_parse($str)); ?>
Note: The certificate needs to use the base64 encoded cer certificate.
The above is the detailed content of How to view SSL certificate information in php. For more information, please follow other related articles on the PHP Chinese website!