致命错误:未知CurlException在...的API连接超时在api 3.0.0在base.facebook.php [英] Fatal error: Uncaught CurlException SSL connection timeout in facebook api 3.0.0 in base.facebook.php

查看:296
本文介绍了致命错误:未知CurlException在...的API连接超时在api 3.0.0在base.facebook.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于所有版本的php-sdk,我得到相同的ssl错误我有增加的超时值,但是同样的问题,但是当我尝试在不同的服务器上相同的示例代码它运行良好。我认为可能有一些服务器相关的问题,如lib curl版本或openssl可以帮助我吗?

解决方案

我有两个星期前同一个问题,两台电脑在Archlinux上运行,卷曲7.24。



默认情况下,卷曲使用SSL版本3,但在我的电脑上看起来像卷曲一样 https://graph.facebook.com 结束了一个超时,而当我特别要求卷曲使用SSL版本3时,它工作。所以在这里我如何解决这个问题:



在Facebook PHP SDK中,在base_facebook.php中,替换:

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

By:

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


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 working well. i think there is might be something server related issue like version of lib curl or openssl can you help me ?

解决方案

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,
);

这篇关于致命错误:未知CurlException在...的API连接超时在api 3.0.0在base.facebook.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆