Created
February 13, 2018 15:32
-
-
Save tnorthcutt/0d1668e4bd998a1e91e8b5028f88878f to your computer and use it in GitHub Desktop.
Testing local TLS version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function stripe_test() | |
{ | |
\Stripe\Stripe::setApiKey("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); | |
\Stripe\Stripe::$apiBase = "https://api-tls12.stripe.com"; | |
try { | |
\Stripe\Charge::all(); | |
echo "TLS 1.2 supported, no action required."; | |
} catch (\Stripe\Error\ApiConnection $e) { | |
echo "TLS 1.2 is not supported."; | |
} | |
} | |
stripe_test(); // returns "TLS 1.2 is not supported." | |
function ssl_test() | |
{ | |
$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; | |
} | |
ssl_test(); // returns "TLS 1.2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment