Facebook API不使用friends_birthday权限返回朋友生日

时间:2012-10-18 09:19:26

标签: facebook

$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'];

这是我的代码。我已经拥有了user_birthday,friends_birthday权限,但print_r($friend_profile);只显示了这个: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 )

生日没有显示。

1 个答案:

答案 0 :(得分:2)

您必须在图表api调用中使用当前的access_token参数

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