Skip to main content

Facebook CurlException SSL connection timeout

My first Facebook application has been giving me this SSL connection timeout error and it seems that it happens once in a while. To resolve this I searched and browsed many sites and finally able to find one which gives some solution.

My solution is different than this website. For mine I thought about increasing the timeout and rather than increase it for each call, I just updated the code that it only increases the timeout for SSL call; that way the server wait time does not gets increased on every call.

Here is my code.

if (isset($opts[CURLOPT_CONNECTTIMEOUT])) {

I placed my code right before the

    curl_setopt_array($ch, $opts);
    $result = curl_exec($ch);

Hope this sample can be of some use to you as well.