Skip to main content

Posts

Showing posts from January, 2011

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])) {
if($opts[CURLOPT_CONNECTTIMEOUT] < 30){
$opts[CURLOPT_CONNECTTIMEOUT] = 30;
}
}

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.