<?php
// based on https://stackoverflow.com/questions/27904854/verify-if-curl-is-using-tls
if (php_sapi_name() == "cli") {

        $ch = curl_init('https://www.howsmyssl.com/a/check');
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $data = curl_exec($ch);
        curl_close($ch);

        $json = json_decode($data);
        echo $json->tls_version;

} else {
        $url = 'https://'.$_SERVER['HTTP_HOST'];
        header('Location: https://'.$_SERVER['HTTP_HOST']);
        die();
}
?>