Monday 20 May 2013

PHP - SSL version

Hi,

I got this problem when I try using API from a service using SSL:
  1. Error log:
    • file_get_contents(): Failed to enable crypto
    • fopen(): Failed to enable crypto
  2. Resolved:
    • Checking your SSL version in browser:
      • The connection uses TLS 1.0
        • function getSSLPage($url) {
              $ch = curl_init();
              curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
              curl_setopt($ch, CURLOPT_HEADER, false);
              curl_setopt($ch, CURLOPT_URL, $url);
              curl_setopt($ch, CURLOPT_SSLVERSION,3); 
          
              ob_start();
              curl_exec($ch);
              curl_close($ch);
              $content = ob_get_contents();
              ob_end_clean();
          
              return $content;
          }
      • The connection uses TLS 1.1
        • You can use normal script

Good luck!

No comments:

Post a Comment