【问题标题】:facebook api no longer workingfacebook api 不再工作
【发布时间】:2014-08-01 07:46:35
【问题描述】:
<?php
session_start();

//included file and use

$app_id = 'xxx';
$app_secret = 'xxx';
FacebookSession::setDefaultApplication($app_id, $app_secret);
$helper = new FacebookRedirectLoginHelper("`http://example/facebook4.0`/", $app_id, $app_secret);
try 
{
    $session = $helper->getSessionFromRedirect();
}
catch(FacebookRequestException $ex) { } 
catch(Exception $ex) { }

$loggedIn = false;

if (isset($session))
{
    if ($session) 
        {
            $loggedIn = true;
            try {                     //logged here and get data
                $user_profile = (new FacebookRequest(
                $session, 'GET', '/me'
                ))->execute()->getGraphObject(GraphUser::className());

               print_r($user_profile); //print data

            } 
            catch(FacebookRequestException $e)  {
                echo "Exception occured, code: " . $e->getCode();
                echo " with message: " . $e->getMessage();
            }   
        }
}

if(!$loggedIn)  //if user is not online // get link and add scope
{
    $loginUrl = $helper->getLoginUrl(array('public_profile','email'));
    echo "<a href='$loginUrl'>Login With Facebook</a>";
}
else
{
    print_r($user_profile); //logout link is generated here 
    echo '<br><br><a href="index.php">Logout</a>'; //print to sceen
    // i dont have more comment to write stack over flow please update it without eating my head to write comments here 

}

?>

它从上周开始工作,但今天根本不工作,重定向后它什么都不显示

【问题讨论】:

  • 可以请人帮忙

标签: php facebook facebook-graph-api facebook-php-sdk


【解决方案1】:

可能是您的 appID 和 app Secret 已更改。尝试确认。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-03-19
    • 1970-01-01
    • 1970-01-01
    • 2013-11-29
    • 1970-01-01
    • 2021-01-14
    • 2021-05-03
    相关资源
    最近更新 更多