Skip to content

Instantly share code, notes, and snippets.

@bhelx bhelx/test.php
Last active Sep 16, 2017

What would you like to do?
TLS Low Level Testing. You should expect to see it print TLS version 1.2.
// This example is for testing php with libcurl
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);
list($header, $body) = explode("\r\n\r\n", $response, 2);
$data = json_decode($body, true);
print "TLS Version Negotiated: " . $data['tls_version'] . "\n";
import httplib
import json
conn = httplib.HTTPSConnection('')
conn.request('GET', '/a/check')
data = json.load(conn.getresponse())
print "TLS Version Negotiated: %s" % data['tls_version']
require 'net/https'
require 'json'
uri = URI("")
http =, uri.port
http.use_ssl = true
data = JSON.parse(http.get('/a/check').body)
puts "TLS Version Negotiated: #{data['tls_version']}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.