TLS 1.0, 1.1 棄用
PHP 檢查 server TLS 版本
ref. https://www.ithome.com.tw/news/126434
//**********************************************************
//**********************************************************
//***
//*** Curl
//***
//**********************************************************
//**********************************************************
echo "<h1>CURL</h1>";
$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 "<pre>TLS version: " . $json->tls_version . "</pre>\n";
echo "<pre>" . print_r($json,true) . "</pre>\n";
//**********************************************************
//**********************************************************
//***
//*** Stream wrapper
//***
//**********************************************************
//**********************************************************
echo "<h1>Stream wrapper</h1>";
$ctx = stream_context_create(['ssl' => [
'capture_session_meta' => TRUE
]]);
$data = file_get_contents('https://www.howsmyssl.com/a/check', FALSE, $ctx);
$json = json_decode($data);
$meta = stream_context_get_options($ctx)['ssl']['session_meta'];
echo "<pre>TLS version: " . $json->tls_version . "</pre>\n";
echo "<pre>" . print_r($json,true) . "</pre>\n";
echo "<pre>Stream meta data\n" . print_r($meta,true) . "</pre>\n";
src: https://gist.github.com/olivierbellone/5fbe074004059c1be5cc81408b72c7b3