You don't have to update your code. You probably have to update your server.
Use this code on a new blank page:
$ch = curl_init('https://www.howsmyssl.com/a/check');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
$json = json_decode($data);
It will tell you the TLS version your site has installed and it if isn't 1.2 or greater, then contact your hosting provider and have them update it for you.