curl https://example.com -w "%{certs}" -o /dev/null > cert.pem
echo | openssl s_client -connect example.com:443 -showcerts > cert.pem