Facebook CurlException 3 没有设置 URL

Posted

技术标签:

【中文标题】Facebook CurlException 3 没有设置 URL【英文标题】:Facebook CurlException 3 No URL set 【发布时间】:2013-04-19 08:41:12 【问题描述】:

我得到了

FacebookApiException 对象 (

[结果:受保护] => 数组

( [错误代码] => 3 [错误] => 数组 ( [消息] => 没有设置 URL! [类型] => CurlException )

    )

[message:protected] => No URL set!
[string:private] => 
[code:protected] => 3
[file:protected] => /home5/theteci0/public_html/team/fb6/base_facebook.php
[line:protected] => 979
[trace:private] => Array
    (
        [0] => Array
            (
                [file] => /home5/theteci0/public_html/team/fb6/base_facebook.php
                [line] => 911
                [function] => makeRequest
                [class] => BaseFacebook
                [type] => ->
                [args] => Array
                    (
                        [0] => https://graph.facebook.com/172535322883581_253291878141258
                        [1] => Array
                            (
                                [fields] => updated_time
                                [method] => GET
                                [access_token] => /*Acc_tkn*/
                            )

                    )

            )

        [1] => Array
            (
                [file] => /home5/theteci0/public_html/team/fb6/base_facebook.php
                [line] => 878
                [function] => _oauthRequest
                [class] => BaseFacebook
                [type] => ->
                [args] => Array
                    (
                        [0] => https://graph.facebook.com/172535322883581_253291878141258
                        [1] => Array
                            (
                                [fields] => updated_time
                                [method] => GET
                            )

                    )

            )

        [2] => Array
            (
                [file] => /home5/theteci0/public_html/team/fb6/base_facebook.php
                [line] => 656
                [function] => _graph
                [class] => BaseFacebook
                [type] => ->
                [args] => Array
                    (
                        [0] => /172535322883581_253291878141258
                        [1] => GET
                        [2] => Array
                            (
                                [fields] => updated_time
                            )

                    )

            )

        [3] => Array
            (
                [file] => /home5/theteci0/public_html/team/user/comments.php
                [line] => 71
                [function] => api
                [class] => BaseFacebook
                [type] => ->
                [args] => Array
                    (
                        [0] => Array
                            (
                                [0] => Facebook Object
                                    (
                                        [appId:protected] => 
                                        [appSecret:protected] => 
                                        [user:protected] => 
                                        [signedRequest:protected] => 
                                        [state:protected] => 
                                        [accessToken:protected] => /*Acc_tkn*/
                                        [fileUploadSupport:protected] => 
                                        [trustForwarded:protected] => 
                                    )

                                [1] => _graph
                            )

                        [1] => Array
                            (
                                [0] => /172535322883581_253291878141258
                                [1] => GET
                                [2] => Array
                                    (
                                        [fields] => updated_time
                                    )

                            )

                    )

            )

    )

)

我经常遇到这个错误,如何预防或解决它?

【问题讨论】:

【参考方案1】:

由于 IPV6 的问题,您应该在您的 facebook api 中包含以下行。

Facebook::$CURL_OPTS[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4;

但是这种替代方案仅适用于 php large 的 5.3 版本和 Curl 版本 > 7.10.8

解决方案:

if((phpversion()>= 5.3)) Facebook::$CURL_OPTS[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; 

【讨论】:

以上是关于Facebook CurlException 3 没有设置 URL的主要内容,如果未能解决你的问题,请参考以下文章

Not hacking CurlException: 60 (cURL SSL Certificate Verification)

Facebook PHP SDK 报错

CurlException: [curl] 51: SSL: 证书验证失败

未捕获的 CurlException:77:设置证书验证位置时出错

Facebook SDK 3.5.1 无法在 Facebook 登录时打开 Facebook 应用

Phonegap 3.0.0 - Facebook SDK 3.6 - FB 插件:找不到 Facebook 连接