【问题标题】:Graph api not working correctly over phpfog, access token refresh required?图形 api 在 phpfog 上无法正常工作,需要刷新访问令牌吗?
【发布时间】:2012-03-20 20:50:01
【问题描述】:

这是我长期面临的问题,之前也曾向question咨询过这个问题,但没有得到解决,但现在我已经完善了我的案例,最新的案例是:

我正在尝试通过图形 api 从代码中检索用户名、发送电子邮件和发布照片,代码在其他服务器上时运行良好,但最近我将应用程序移至 phpfog,从那时起我就面临这个奇怪的问题。

问题似乎只在于需要访问令牌的信息和功能(全名、电子邮件、发布照片),其他信息(例如个人资料图片等)仍然可以轻松检索。

相同的代码在其他服务器上工作得很好,但是一旦我把它带入 phpfog,它就会停止以这种奇怪的方式工作。

如果需要,是否需要刷新 access_token,我该怎么做?

try {
                $userId = $_POST["user_id"];
                $oauth_token = $_POST["oauth_token"];

                $userName =   json_decode(file_get_contents('https://graph.facebook.com/' . $userId)) -> name;
                $userGender =   json_decode(file_get_contents('http://graph.facebook.com/' . $userId)) -> gender;
                $userPpicture =   json_decode(file_get_contents('http://graph.facebook.com/' . $userId)) -> picture;
            } catch(Exception $e) {
                echo $e -> getMessage();
                echo "<br>";
            }

请帮我解决这个问题。 谢谢。

【问题讨论】:

    标签: php facebook facebook-graph-api phpfog


    【解决方案1】:

    在咨询了 phpfog 支持后,我知道他们的共享主机计划不支持 函数file_get_contents

    他们的任何专用计划都将能够运行受限于其共享服务的命令。

    【讨论】:

      猜你喜欢
      • 2016-09-14
      • 2011-10-05
      • 2017-08-11
      • 2014-12-04
      • 2017-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-16
      相关资源
      最近更新 更多