user1755741
user1755741

Reputation: 11

Facebook API not returning friends birthday using friends_birthday permission

$fb_friends = $f1->getFacebookFriends();
$fb_friends_Count = $f1->displayFriendCount(array('users'=>$fb_friends, 'nb_display'=>1));

//get current date
$date_now=getdate();
$current_day=$date_now['mday'];
$current_month=$date_now['mon'];
$current_year=$date_now['year'];

//get friends' details  
for($u=0; $u<$fb_friends_Count; $u++) {
    $fb_friends_id=$fb_friends[$u]['id'];
    $friend_profile1="http://graph.facebook.com/".$fb_friends_id."/";
    $friend_profile = @file_get_contents($friend_profile1);
    $friend_profile = json_decode($friend_profile,true);    
    $gender=$friend_profile['gender'];
    print_r($friend_profile);

    //get birthday
    $birthday=$friend_profile['birthday'];

Here is my code. I already have the user_birthday, friends_birthday permission but the print_r($friend_profile); only shows this: Array ( [id] => xxxxxxx [name] => Joye Tanay Lipata [first_name] => Joye [middle_name] => Tanay [last_name] => Lipata [link] => http://www.facebook.com/joye.lipata [username] => joye.lipata [gender] => female [locale] => en_US )

The birthday is not showing.

Upvotes: 1

Views: 952

Answers (1)

aykut
aykut

Reputation: 3094

You must use current access_token parameter in graph api call

$friend_profile1 = "http://graph.facebook.com/".$fb_friends_id."/?access_token=".$access_token;

Upvotes: 2

Related Questions