【发布时间】:2011-09-21 14:11:12
【问题描述】:
我想我快要发疯了!
我在我的工作机器上登录了我的个人 Facebook 帐户,我正在使用的应用程序运行良好,但在以我身份登录的任何其他机器上、应用程序管理员或其他任何人上,页面似乎一直在不断刷新url 中的 state 参数只是在页面加载之间旋转并改变。 (我的办公桌上有一台笔记本电脑,都使用 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;
}
?>
【问题讨论】:
-
请注意:不要使用 PHP 短标签。
-
谢谢,我通常不记得,不记得是不是我。不过现在改了。
标签: php facebook facebook-graph-api