test.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace loyalsoft;
  3. include __DIR__ . '/main.php';
  4. //var_dump(__DIR__);
  5. echoLine("phpver: " . PHP_VERSION . PHP_EOL);
  6. echoLine("tsDay:" . totalDays());
  7. //SelfChecker::CheckAll();
  8. //
  9. //set_time_limit(15); # 设置执行超时时间
  10. //
  11. $url = 'https://fancyssl.hboeck.de/';
  12. $protocols = [
  13. 'TLS1.0' => ['protocol' => CURL_SSLVERSION_TLSv1_0, 'sec' => false],
  14. 'TLS1.1' => ['protocol' => CURL_SSLVERSION_TLSv1_1, 'sec' => false],
  15. 'TLS1.2' => ['protocol' => CURL_SSLVERSION_TLSv1_2, 'sec' => true],
  16. 'TLS1.3' => ['protocol' => CURL_SSLVERSION_TLSv1_3, 'sec' => true],
  17. ];
  18. foreach ($protocols as $name => $value) {
  19. $ch = curl_init();
  20. curl_setopt($ch, CURLOPT_URL, $url);
  21. curl_setopt($ch, CURLOPT_SSLVERSION, $value['protocol']);
  22. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  23. $response = curl_exec($ch) !== false;
  24. if ($value['sec'] && !$response) {
  25. echo "Secure $name not supported =( \n";
  26. } elseif ($value['sec'] && $response) {
  27. echo "Ok! Secure $name supported \n";
  28. } elseif (!$value['sec'] && $response) {
  29. echo "OK! Insecure $name supported =( \n";
  30. } elseif (!$value['sec'] && !$response) {
  31. echo "Insecure $name not supported\n";
  32. }
  33. }