Facebook api php select friend by id -
i want birthday date of specific friend using facebook api php. have friend's id passed form friend list in te variable $_post[friend_id]. i'm doing can't friend data:
$user = $facebook->getuser(); $perms = array('scope' => 'email,user_photos,read_mailbox,friends_birthday,user_birthday,user_likes'); if ($user) { try { $user_profile = $facebook->api('/me'); //get friend data $friend_profile = $facebook->api('/me/friends/' . $_post[friend_id]); } catch (facebookapiexception $e) { $user = null; } } else { die('<script>top.location.href="'.$facebook->getloginurl($perms).'";</script>'); } echo $friend_profile['birthday']; but can't see birthday date.
thanks
your api call wrong, getting birthday of friend need one:
$friend_profile = $facebook->api('/' . $_post[friend_id] . '?fields=birthday'); and should remove first call api (/me), because every call needs time , don´t use data.
Comments
Post a Comment