用facebook登录不能使用php 5.2

时间:2014-09-01 11:24:49

标签: php facebook curl

我尝试使用简单的核心PHP代码设置Facebook插件登录。

它给了我这个错误

Notice: Use of undefined constant CURLOPT_IPRESOLVE - assumed 'CURLOPT_IPRESOLVE' 
in /home/public_html/facebook/src/base_facebook.php on line 997

我的php版本:

PHP Version 5.2.17

curl版本是:

cURL support        : enabled
cURL Information    : libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

似乎问题在于这个功能:

if ($result === false && empty($opts[CURLOPT_IPRESOLVE])) {
    $matches = array();
    $regex = '/Failed to connect to ([^:].*): Network is unreachable/';
    if (preg_match($regex, curl_error($ch), $matches)) {
      if (strlen(@inet_pton($matches[1])) === 16) {
        self::errorLog('Invalid IPv6 configuration on server, '.
                       'Please disable or get native IPv6 on your server.');
        self::$CURL_OPTS[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;
        curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
        $result = curl_exec($ch);
      }
    }
}

我该如何运行它? 意味着这个错误的解决方案是什么?

0 个答案:

没有答案