Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to solve problem of curlexception 6: name lookup time out error in facebook new graph api

Tags:

php

facebook

Hi I m creating application on facebook using new graph api but it gives error as

curlexception 6: name lookup time out in facebook.php file.

The problem is that same code is works fine on other server and not gives this error. How to solve this error Please help me.

like image 513
user392406 Avatar asked Dec 10 '22 10:12

user392406


2 Answers

I had this same problem when developing locally on a virtual machine. I solved it by upping my Curl Connect Timeout.

Look for CURLOPT_CONNECTTIMEOUT = 10 in your facebook SDK. Try changing it to CURLOPT_CONNECTTIMEOUT = 30 or CURLOPT_CONNECTTIMEOUT = 60

like image 164
broox Avatar answered Dec 29 '22 00:12

broox


Update: form Facebook SDK 3.x the CURLOPT_CONNECTTIMEOUT is located in the file base_facebook.php not in the facebook.php.

I believe you can also change the value dynamically as the CURL_OPTS are send every makeRequest (please edit if this is not the case!):

$facebook = new Facebook(array(
       'appId' => $your['AppId'],
       'secret' => $your['AppSecret'],
       'cookie' => true
));

$facebook->CURL_OPTS['CURLOPT_CONNECTTIMEOUT'] = 30; 

See also: SSL Connection timeout in facebook fql for other timeout issues :D

like image 21
mewiki Avatar answered Dec 29 '22 00:12

mewiki