At this point, $urlOfIssuerCertificate will contain the URL where the issuer certificate can be downloaded from (if it's an empty string, that means that the issuer certificate URL is not included in your certificate).

Obtaining the OCSP Responder URL

To check if a certificate is valid, we need to know an URL, provided by the authority that issued the certificate, that can be called to check if the certificate has been revoked.

This URL may be included in the HTTPS certificate itself.

To get it, you can use the following code (provided that '/path/to/certificate' is the path to a local file that contains your HTTPS certificate):

At this point, $response contains an instance of the Ocsp\Response class:

the certificate is not revoked if $response->isRevoked() === false

the certificate is revoked if $response->isRevoked() === true (you can get the devocation date/time by calling $response->getRevokedOn())

in case of unknown state, $response->isRevoked() will return null

Exceptions

Problems may arise while loading the certificates, creating the request body for the OCSP Responder, analyzing the response from the OCSP Responder.
To catch these errors, you can enclose your code within try/catch statements: