Last active
April 27, 2016 20:10
-
-
Save phpdave/3de8e89b9bec3b3b9725a69739d0c7ff to your computer and use it in GitHub Desktop.
This file contains hidden or 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
[me@webserver /]# php recurlysCurlTest.php | |
TLS Version Negotiated: TLS 1.0 | |
[me@webserver /]# php recurlysCurlTestModifiedWithCURLOPT_SSLVERSION.php | |
TLS Version Negotiated: TLS 1.2 |
This file contains hidden or 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 | |
// This example is for testing php with libcurl | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://www.howsmyssl.com/a/check"); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
list($header, $body) = explode("\r\n\r\n", $response, 2); | |
$data = json_decode($body, true); | |
print "TLS Version Negotiated: " . $data['tls_version'] . "\n"; |
This file contains hidden or 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 | |
// This example is for testing php with libcurl | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://www.howsmyssl.com/a/check"); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
list($header, $body) = explode("\r\n\r\n", $response, 2); | |
$data = json_decode($body, true); | |
print "TLS Version Negotiated: " . $data['tls_version'] . "\n"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment