我有这个漂亮的股票通用代码。如果我已登录(应用程序管理员),则会显示我的所有状态。如果我与任何其他用户登录,则不显示任何内容。为什么呢?
<?php
header('p3p: CP="NOI ADM DEV PSAi COM NAV OUR OTR STP IND DEM"');
include_once('facebook.php');
$app_id = '289544004746';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => '289544004746',
'secret' => '5772f9f5abbcc84e794c28169a399d4e',
'cookie' => true,
));
$session = $facebook->getSession();
$me = null;
// Session based API call.
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
// login or logout url will be needed depending on current user state.
if ($me) {
$logoutUrl = $facebook->getLogoutUrl(array('next' => 'http://autobotcentral.info/logout.php'));
echo "<a href='$logoutUrl'>Log out </a>";
} else {
$loginUrl = $facebook->getLoginUrl(array('req_perms' => 'user_activities,user_status,read_status'));
echo "<a href='$loginUrl'>Login</a>";
?>
<html>
<head>
</head>
</html>
<?php
}
$result = $facebook->api(array(
'query' => 'SELECT uid,status_id,message FROM status WHERE uid = me()',
'method' => 'fql.query'));
print_r($result);
?>
答案 0 :(得分:2)
您需要获得user_status
扩展权限才能检索用户的状态
http://developers.facebook.com/docs/authentication/permissions
您可以使用FB.login
执行此操作