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:
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()
?
- It seems that you are using the old php-sdk? try using this one.
- Make sure you have the
user_events
permission. Check this answer. With the new SDK, it's as simple as:
$events= $facebook->api('/me/events');
精彩评论