Php check if ssl certificate is valid
Is is possible to get the details like if a domain (say Show I need to validate some URLs, whether they have SSL certificate or not. I know, by using Any help would be much appreciated. asked Dec 29, 2014 at 12:43
Krishna MohanKrishna Mohan 1,4833 gold badges22 silver badges28 bronze badges 6 Finally, I've ended up with the following my code:
If HTTPS is enabled for a domain,
If it doesn't exist it returns I've checked a few domains. It seems to be working fine. I hope it will help someone.
answered Dec 30, 2014 at 13:24
Krishna MohanKrishna Mohan 1,4833 gold badges22 silver badges28 bronze badges 1 This function will not only check if the domain has a SSL certificate, but also confirms, if the certificate matches the requested domain. The most important part is the function
answered Dec 30, 2016 at 15:22
PhilippPhilipp 8,9965 gold badges56 silver badges65 bronze badges 4 Here is a different solution that I found somewhere on github (cannot find the repo again...) It's a similar approach to the accepted answer, but uses fsockopen to test, if we can establish a SSL connection on port 443. If the connection is refused then the domain does not have a ssl certificate.
answered Dec 30, 2016 at 13:40
PhilippPhilipp 8,9965 gold badges56 silver badges65 bronze badges 2 There's no way to check if the certificate is secure or not using PHP alone without API (green padlock) But you can use this, which use a API: https://github.com/spatie/ssl-certificate
cs95 345k85 gold badges636 silver badges684 bronze badges answered Aug 5, 2019 at 22:49
How do I know if my SSL certificate is valid?Chrome has made it simple for any site visitor to get certificate information with just a few clicks: Click the padlock icon in the address bar for the website. Click on Certificate (Valid) in the pop-up. Check the Valid from dates to validate the SSL certificate is current.
What is SSL certificate in PHP?A Secure Socket Layer (SSL) certificate encrypts the connection between the customer and your web server. The information is rendered unreadable by all third parties (identity thieves and hackers). The core purpose of an SSL certification would be to safeguard server-client communication.
How do you check if https is enabled in Linux?(Use netstat -t -l -p -n if you just want the port number, in which case you'll see *:443 instead of *:https ). This tells you that there's a socket listening on port 443.
|