我想我会发疯了!
我在我的工作机器上登录了我的个人Facebook帐户,我正在使用的应用程序工作正常,但在以我身份登录的任何其他计算机上,应用程序管理员或其他任何人的页面似乎都在继续刷新网址中的状态参数正在呼呼并在页面加载之间切换。 (我有一台笔记本电脑坐在我的桌子上,两者都使用Firefox)
我确信它在所有正在测试它的机器上工作了。今天它开始时出现错误,但我记不起错误代码了,但这与重新直接的url不属于域名所有,但现在似乎没有出现。
我也不是该应用的管理员。
以下是相关代码:
<?
error_reporting(0);
// Facebook PHP SDK
include_once "src/facebook.php";
// app id and seret from the facebook app
$appId = 'xxxxxxxxxxxxxx';
$secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
$facebook = new Facebook(array(
'appId' => $appId,
'secret' => $secret,
'cookie' => true,
));
//Facebook Authentication part
$user = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(
array(
'canvas' => 1,
'fbconnect' => 0,
'scope' => 'user_status,publish_stream,user_photos'
)
);
if ($user)
{
try
{
// page id and the feed we want
$user_feed = $facebook->api('PAGENUMBER/feed');
echo "<div id=\"graph\">";
$count = 0;
for ($i=0; $i<25; $i++)
{
// only want statuses - no videos, events, links etc.
if ($user_feed['data'][$i]['type'] == "status")
// just grabbing stuff and echoing it out
// blah blah blah
}
}
catch (FacebookApiException $e)
{
$user = null;
}
// close graph div
echo "</div>";
}
// if the user is not logged in then redirect to login page
if (!$user)
{
echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
exit;
}
?>
答案 0 :(得分:0)
这很痛苦,但取出了if ($user)
和try
catch
以及登录重定向和所有似乎都有用的内容。