0

I'm using maxmind GEOIP precision online service to get information about visitor region/city. They are upgrading their protocol to TLS 1.2. I tried to change my code, but they told me that logs indicate that I'm still sending requests using TLS 1.0

$ch = curl_init();  
curl_setopt($ch, CURLOPT_URL, "https://geoip.maxmind.com/geoip/v2.1/insights/178.166.46.246"); 
curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 


curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);


$result = curl_exec($ch);  
curl_close($ch);  
return $result;

Adding "CURL_SSLVERSION_TLSv1_2" doesn't seem to help. What is that I may be missing here?

Raymond
  • 31
  • 4

1 Answers1

0

Add

curl_setopt ($ch, CURLOPT_SSLVERSION, 6); 

This enforces the request to use TLS 1.2.

Danyal Sandeelo
  • 12,196
  • 10
  • 47
  • 78
  • Please describe in your answer, what was the problem, and how will this snippet solve it, to help others understand this answer – FZs Oct 13 '19 at 08:14