Facebook $ facebook-> getUser()始终返回0

时间:2012-07-16 07:12:47

标签: facebook

我正面临基于Facebook应用脚本的问题。它总是返回0,即使用户登录到facebook。我看一下旧的讨论,但我找不到解决方案。请看一下代码。

<?php 
    require "config/database.class.php";
    require 'fbook/src/facebook.php';
    require "core/corefunction.php";

    $facebook = new Facebook(array(
        'appId'  => 'xxxxxxx',
   'secret' => 'xxxxxxxxx',
));

$user = $facebook->getUser();

   if ($user) {
 try {

  $user_profile = $facebook->api('/me');
 } catch (FacebookApiException $e) {
error_log($e);
$user = null;
 }  
   }
          if ($user) {
echo "Yes";exit;
}
else{

$urlf= $facebook->getLoginUrl(array('scope' => 'user_status,publish_stream'));
?>
<script language="javascript" type="text/javascript">
                document.location.href="<?php echo $urlf; ?>";
</script>
<?php
exit;

}  ?&GT;

我在验证facebook之后得到了这样的网址,

http://www.example.com/fblog.php?state=91e3e7013fcfeb01df23eed352add987&code=AQAyitCNGSqtCEwMueFi5RvFILI0YC2P4IFdaY0TFK7_ay5vSU1RZh1Ab56DS6aUokQj9VS6RCoYTKmFa0H0AbUFsZBWZTLlFvWqVoOMpwZQcTeCoHcZ1o3NE2VljyoXgfJERreb2ZvL1MhwZ2rKSaInk9SMiyiaNrRXU86fkiL6GBbhrM1aCfuWPq7jqwqG_IM#_=_

它被连续调用......

0 个答案:

没有答案