Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CurlException: 28: connect() timed out?

Today I was trying to make application on Facebook using PHPSDK and I saw ocassionaly displayed exception from library saying CurlException: 28: connect() timed out!

So, to check if it's my code bug I downloaded latest library PHPSDK from github. Then I was trying to run examples/example.php file few times, after that I look into error log and this error was also there (not always, looks like it's kind of random thing).

I was trying to find solution on developer forum without any success, as I notice this kind of problem occur in the past, and none knows why.

Any solutions?

Thanks

like image 883
delpierofan Avatar asked Nov 15 '11 11:11

delpierofan


1 Answers

Same here, totally random but on large access site the error log file come quickly full :/

Bug Open here : http://developers.facebook.com/bugs/182705755149358

Production server Use the same PHP code as shown in the given exemple : https:// developers.facebook.com/blog/post/534/

2 connections on 6 pass. else :

***`print_r($e->getResult());`***

Give :

Array
(
    [error_code] => 28
    [error] => Array
        (
            [message] => connect() timed out!
            [type] => CurlException
        )

) 

Else here are the Options in the Facebook.php

/**
* Default options for curl.
*/
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-3.1',
);

I've Try this :

  • Raise ConnectTimeOut => Same Problem.
  • Change Api-Read.Facebook.Com to Api.Facebook.Com => Same Problem.
  • Try with there Curl Params : CURLOPT_SSL_VERIFYPEER => false,$opts[CURLOPT_SSL_VERIFYHOST] = 2; But not a SSL Problem for my case.
  • Try to Connect to FB Api/Graph/Api-read server using telnet and port 443 => Same Problem. Respond only 2 time on 6...

Still actualizing the Platform Live-Status page of Facebook ... Api response time raising ... https://developers.facebook.com/live_status

like image 75
Cetic Avatar answered Oct 20 '22 08:10

Cetic