【问题标题】:Facebook getuser return 500 internal error in PHP SDKFacebook getuser 在 PHP SDK 中返回 500 内部错误
【发布时间】:2016-02-02 21:00:37
【问题描述】:

我有这种类型的问题,我使用的是 PHP SDK 最新版本,从 3 月开始,当我必须登录时,我的应用程序停止了。我已经完成了最新版本的上传,但是现在当 php 执行时

$user = $facebook->getUser();

我收到错误 500 internal etc. 等。我已经尝试了一切,但现在我不知道是什么问题,我也尝试过Facebook PHP SDK 500 - Internal server error

但我只获得内部错误。如果有人可以帮助我。代码是这样的

<?php

    require 'src/facebook.php';

    $facebook = new Facebook(array(
      'appId'  => 'fdsafdasfdasfdsafas8',
      'secret' => 'dasgasgasgasgas',
    ));

    // See if there is a user from a cookie
    $user = $facebook->getUser();

    if ($user) {
      try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
      } catch (FacebookApiException $e) {
        echo '<pre>'.htmlspecialchars(print_r($e, true)).'</pre>';
        $user = null;
      }
    }

    ?>
    <!DOCTYPE html>
    <html xmlns:fb="http://www.facebook.com/2008/fbml">
      <body>
        <?php if ($user) { ?>
          Your user profile is
          <pre>
            <?php print htmlspecialchars(print_r($user_profile, true)) ?>
          </pre>
        <?php } else { ?>
          <fb:login-button></fb:login-button>
        <?php } ?>
        <div id="fb-root"></div>
        <script>
          window.fbAsyncInit = function() {
            FB.init({
              appId: '<?php echo $facebook->getAppID() ?>',
              cookie: true,
              xfbml: true,
              oauth: true
            });
            FB.Event.subscribe('auth.login', function(response) {
              window.location.reload();
            });
            FB.Event.subscribe('auth.logout', function(response) {
              window.location.reload();
            });
          };
          (function() {
            var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol +
              '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
          }());
        </script>
      </body>
    </html>

【问题讨论】:

    标签: php facebook sdk


    【解决方案1】:

    您可能需要启用 ssl 库, 您还可以检查 Apache 日志中的错误

    【讨论】:

    • 非常感谢,我已经在服务器上尝试了我的安全页面,我得到了错误 500,所以我认为你有理由...,现在我发送了一封电子邮件到房屋托管以解决问题我在安全页面正常后我再试一次......谢谢。
    猜你喜欢
    • 1970-01-01
    • 2012-07-09
    • 1970-01-01
    • 1970-01-01
    • 2013-10-03
    • 1970-01-01
    • 2012-01-19
    • 2011-10-11
    • 2013-02-16
    相关资源
    最近更新 更多