Is is possible to get the details like if a domain (say `www.example.com`) is HTTPS ready?

I need to validate some URLs, whether they have SSL certificate or not. I know, by using `$_SERVER['HTTPS']` we can check our server details. but how can I achieve the same for other domains.

Any help would be much appreciated.