öàªèÒ »ÃÐàÀ·µèÒ§æ
öàªèÒ ¨Ñ§ËÇÑ´
facebook connect login Uncaught CurlException: 7: couldn't connect to host thrown
Çѹ·Õè: 23/08/2013
àÇÅÒ: 20:03:42
Uncaught CurlException: 7: couldn't connect to host thrown
¤ÇÒÁ¤Ô´àËç¹·Ñé§ËÁ´
23/08/2013 | 20:12:38
If you are facebook developer, and are using the latest facebook php sdk, facebook.php grabbed from github.com, and are facing the problem similiar to as defined below:
PHP Fatal error: Uncaught CurlException: 6: name lookup timed out thrown in //facebook.php on line 592
This is probably the host is not given enough time to contact with facebook server. To solve this problem, open facebook.php with your editor, and go to line 89 to find the code below:
1
2
3
4
5
6
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-2.0',
);
Modify CURLOPT_CONNECTION to increase its value to, 30 or higher.
1
CURLOPT_CONNECTTIMEOUT => 30,
and test your facebook application again to see if it works.
PHP Fatal error: Uncaught CurlException: 6: name lookup timed out thrown in /
This is probably the host is not given enough time to contact with facebook server. To solve this problem, open facebook.php with your editor, and go to line 89 to find the code below:
1
2
3
4
5
6
public static $CURL_OPTS = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php-2.0',
);
Modify CURLOPT_CONNECTION to increase its value to, 30 or higher.
1
CURLOPT_CONNECTTIMEOUT => 30,
and test your facebook application again to see if it works.
try {
// facebook code
} catch (Exception $e) {
// maybe something more graceful...
echo 'Caught exception: ', $e->getMessage(), "\n";
}
// regular execution continues.