PHP Scripts Communicating with HTTPS Servers

This chapter provides tutorial notes and example codes on writing PHP scripts communicating with HTTPS servers. Topics include configuring the OpenSSL module; using file_get_contents(), fopen(), fsockopen() and stream_socket_client() functions with OpenSSL; setting 'verify_peer' SSL context option to verify server's certificates; concatenating multiple CA certificates in a single PEM file; Adding CA certificates.

Configuring PHP OpenSSL on Windows

Testing OpenSSL with file_get_contents()

OpenSSL Configuration Errors

SSL Context Options for OpenSSL

Asking OpenSSL to Verify Server's Certificate

OpenSSL Failing to Verify Server's Certificate

Multiple CA Certificates in a Single File

Testing OpenSSL with fopen()

Testing OpenSSL with fsockopen()

Adding CA Certificates for the PHP Engine

Testing OpenSSL with stream_socket_client()

Conclusions:

Table of Contents

 About This Book

 Introduction of PKI (Public Key Infrastructure)

 Introduction of HTTPS (Hypertext Transfer Protocol Secure)

 Using HTTPS with Google Chrome

 Using HTTPS with Mozilla Firefox

 HTTPS with Microsoft Edge

 Using HTTPS with Apple Safari

 HTTPS with IE (Internet Explorer)

 Android and Server Certificate

 iPhone and Server Certificate

 Windows Certificate Stores and Console

 RDP (Remote Desktop Protocol) and Server Certificate

 macOS Certificate Stores and Keychain Access

 Perl Scripts Communicating with HTTPS Servers

PHP Scripts Communicating with HTTPS Servers

 Java Programs Communicating with HTTPS Servers

 .NET Programs Communicating with HTTPS Servers

 CAcert.org - Root CA Offering Free Certificates

 PKI CA Administration - Issuing Certificates

 Comodo Free Personal Certificate

 Digital Signature - Microsoft Word

 Digital Signature - OpenOffice.org 3

 S/MIME and Email Security

 PKI (Public Key Infrastructure) Terminology

 Archived Tutorials

 References

 Full Version in PDF/EPUB