Verify if curl is using TLS
The snippet can be accessed without any authentication.
Authored by
Raul Barreras
Edited
curl-version.php 508 B
<?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();
}
?>
Please register or sign in to comment