Fatal error: Uncaught CurlException SSL connection timeout in facebook api 3.0.0 in base.facebook.php

后端 未结 1 1565
星月不相逢
星月不相逢 2021-01-14 18:43

i am getting same ssl error for all version of php-sdk i have increased timeout value but strill same problem but when i tried same sample code on different server it worki

相关标签:
1条回答
  • 2021-01-14 19:10

    I had the same issue two weeks ago with two computers running on Archlinux with curl 7.24.

    Curl use SSL version 3 by default but it looks like on my computers the curl to https://graph.facebook.com ended up in a timeout whereas it worked when I specifically asked curl to use SSL version 3. So here how I solved the issue :

    In the Facebook PHP SDK, in base_facebook.php, replace :

    public static $CURL_OPTS = array(
      CURLOPT_CONNECTTIMEOUT => 10,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_TIMEOUT => 60,
      CURLOPT_USERAGENT => 'facebook-php-3.1',
    );
    

    By :

    public static $CURL_OPTS = array(
      CURLOPT_CONNECTTIMEOUT => 10,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_TIMEOUT => 60,
      CURLOPT_USERAGENT => 'facebook-php-3.1',
      CURLOPT_SSLVERSION => 3,
    );
    
    0 讨论(0)
提交回复
热议问题