With SNI:
$ openssl s_client -showcerts -servername www.example.com -connect www.example.com:443 </dev/nullNo SNI:
$ openssl s_client -showcerts -connect www.example.com:443 </dev/nulltaken from: https://stackoverflow.com/questions/7885785/using-openssl-to-get-the-certificate-from-a-server