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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

node.js - Bad Request - node js ajax post -

uitableview - Create and use custom prototype table cells in xamarin ios using storyboard -