0

由于某种原因,我的代码不起作用,我不确定为什么。这种格式适用于其他表,但是当我尝试从 event_member 表中检索事件 ID 时,它没有返回任何内容。有什么我做错了吗。我知道我参加了几个活动,所以它必须返回它们。

require_once 'facebook.php';    //Facebook class

$Facebook = new Facebook($config);                  //Initialize Facebook
$fb = $Facebook->getUser();                             //Get the user

//Authorize the user
if ($fb)
{
    try 
    {
        $user = $Facebook->api('/me');
    } 
    catch (FacebookApiException $e) 
    {
        echo "There was an unexpected error. Please contact us.";
        $fb = null;
    }
}

try
{
    $fql = "SELECT eid FROM event_member WHERE uid = me()";
    $param = array('method' => 'fql.query', 'query' => $fql, 'callback' => '');

    $result = $Facebook->api($param);

    foreach ($result as $row)
    {
        echo $row["eid"] . "<br/>";
    }
}
catch (FacebookApiException $e) 
{
  echo $e;
}
4

1 回答 1

0

要读取 event_member 表,您需要:非公开活动的user_events权限或查看用户正在参加的所有活动

来源: https ://developers.facebook.com/docs/reference/fql/event_member/


如何在 PHP 中请求权限:

$params = array(
  'scope' => 'read_stream, friends_likes',
  'redirect_uri' => 'https://www.myapp.com/post_login_page'
);

$loginUrl = $facebook->getLoginUrl($params);
于 2013-03-09T23:47:52.137 回答