douleijiang8111
douleijiang8111
2014-11-12 13:10
浏览 30
已采纳

用户使用PHP api 3.2.3在Facebook上参加活动[关闭]

I seem to do something wrong here. The api call doesn't seem to work, I don't get anything return aswell.

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);
        }
    }
}

图片转代码服务由CSDN问答提供 功能建议

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

 尝试{
 $ fbID = $ facebook-&gt; getUser(); \  n} 
catch(FacebookApiException $ e){
 $ loginUrl = $ facebook-&gt; getLoginUrl(array('scope'=&gt;'email,user_events,rsvp_event')); 
返回“&lt; script language ='  javascript'type ='text / javascript'&gt; top.location.href ='“。$ loginUrl。”';&lt; / script&gt;“; 
} 
if($ fbID!=”0“){
  $ permissions = $ facebook-&gt; api('/ me / permissions / rsvp_event','get'); 
 if($ permissions ['data'] ['0'] ['status'] =='grant'  ){
 $ fbEID = $ activiteit ['facebookid']; 
尝试{
 //这就是出错的地方... $结果不会返回任何内容,但我也没有收到任何错误。  .. 
 //但是我确信代码会读取这个......一个简单的回声效果很好...... 
 $ result = $ facebook-&gt; api('/ /.$ fbEID。“/ atte'  ,'POST');  
} catch(FacebookApiException $ e){
 print_r($ e); 
} 
} 
} 
   
 
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doubao7287
    doubao7287 2014-11-12 13:14
    已采纳

    Try this:

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

    You're using double quotes inside, when you should be using single quotes, as outside.

    点赞 评论

相关推荐