开发者

Facebook API - really basic events.get() request, help needed

I want to get all the events of the logged in user, who has the app installed.

This is not intended to be a public app and is for me only. The user (me) has has given the app permissions like below:

Facebook API - really basic events.get() request, help needed

I'm using this code:

<?php
// get all events for logged in fb user
require_once    'facebook.php';
$app_apikey =   'my-key-is-here';
$app_secret =   'my-secret-is-here';
$facebook =     new Facebook($app_apikey, $app_secret);
$user_id =      $facebook->require_login(); //returns my facebook user_id fine!
$events =       $facebook->api_client->events_g开发者_如何学运维et($user_id); //returns nothing!
echo $events;   //nothing    
print_r($events); //no array to print
print_r(json_decode($events)); //no array to print 
?>

Any ideas on why I'm getting a no results from events.get()?


  1. It seems that you are using the old php-sdk? try using this one.
  2. Make sure you have the user_events permission. Check this answer.
  3. With the new SDK, it's as simple as:

    $events= $facebook->api('/me/events');
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜