Get the cert

$ openssl s_client -showcerts \
    -servername hostname.com \
    -connect hostname.com:443 \
    > hostname-cacert.pem

Use the cert and print everything

$ curl --cacert hostname-cacert.pem \
    --verbose \
    https://hostname.com/...