Skip to content

Instantly share code, notes, and snippets.

@tnorthcutt
Created February 13, 2018 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tnorthcutt/0d1668e4bd998a1e91e8b5028f88878f to your computer and use it in GitHub Desktop.
Save tnorthcutt/0d1668e4bd998a1e91e8b5028f88878f to your computer and use it in GitHub Desktop.
Testing local TLS version
<?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