Comment 68 for bug 965371

Revision history for this message
kylea (kylea) wrote :

I have replaced my calls to

$content = file_get_contents($url);

with a curl call...

    $curl = curl_init($url);

    if (is_resource($curl) === true)
    {
        curl_setopt($curl, CURLOPT_FAILONERROR, true);
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_SSLVERSION, 3);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);

        if (isset($post) === true)
        {
            curl_setopt($curl, CURLOPT_POST, true);
            curl_setopt($curl, CURLOPT_POSTFIELDS, (is_array($post) === true) ? http_build_query($post, '', '&') : $post);
        }

            $content = curl_exec($curl);

        curl_close($curl);
    }

Key point here is ----> curl_setopt($curl, CURLOPT_SSLVERSION, 3);

This seems to work on http and https sites.