用户使用PHP api 3.2.3参加Facebook上的活动

时间:2014-11-12 13:10:25

标签: php facebook events

我似乎在这里做错了什么。 api调用似乎不起作用,我也没有得到任何回报。

try {
    $fbID = $facebook->getUser();
} 
catch (FacebookApiException $e) {
    $loginUrl = $facebook->getLoginUrl(array('scope' => 'email,user_events,rsvp_event'));
    return "<script language='javascript' type='text/javascript'>top.location.href='".$loginUrl."';</script>";
}
if ($fbID != "0") {
    $permissions = $facebook->api('/me/permissions/rsvp_event', 'get');
    if ($permissions['data']['0']['status'] == 'granted') {
        $fbEID = $activiteit['facebookid'];
        try {
            //This is where is goes wrong... $result doesn't return anything, however I don't get any error aswell...
            //However I'm sure that the code reads this... A simple echo works well...
            $result = $facebook->api('/".$fbEID."/attending', 'POST');                          
        } catch (FacebookApiException $e) {
                print_r($e);
        }
    }
}

1 个答案:

答案 0 :(得分:1)

试试这个:

$result = $facebook->api('/'.$fbEID.'/attending', 'POST');

当你使用单引号时,你在里面使用双引号。