Home  >  Article  >  Backend Development  >  How to view SSL certificate information in php

How to view SSL certificate information in php

怪我咯
怪我咯Original
2017-07-13 09:22:212942browse

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(&#39;2.cer&#39;);
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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn