['protocol' => CURL_SSLVERSION_TLSv1_0, 'sec' => false], 'TLS1.1' => ['protocol' => CURL_SSLVERSION_TLSv1_1, 'sec' => false], 'TLS1.2' => ['protocol' => CURL_SSLVERSION_TLSv1_2, 'sec' => true], 'TLS1.3' => ['protocol' => CURL_SSLVERSION_TLSv1_3, 'sec' => true], ]; foreach ($protocols as $name => $value) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSLVERSION, $value['protocol']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch) !== false; if ($value['sec'] && !$response) { echo "Secure $name not supported =( \n"; } elseif ($value['sec'] && $response) { echo "Ok! Secure $name supported \n"; } elseif (!$value['sec'] && $response) { echo "OK! Insecure $name supported =( \n"; } elseif (!$value['sec'] && !$response) { echo "Insecure $name not supported\n"; } }