2012-10-18 3 views
1
$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)Facebook API 친구가 생일을 사용하여 생일을 반환하지 않음

생일이 표시되지 않습니다.

+0

당신이 질의하고 _all_ 친구들이인가, 아니면 그냥 한 번 특정에 대한 그래프 API 호출에 현재 access_token이 매개 변수를 사용해야합니다? 사용자가 자신의 생일이 친구가 사용하는 앱과 공유되지 않도록 개인 정보 설정을 설정 한 경우 그러한 친구에게는 생일 값을주지 않습니다. – CBroe

+0

이것은 내 모든 친구들을위한 것입니다. 왜 그런지 모르지만 생일은 배열에 표시되지 않습니다. – user1755741

+0

그들은 아마도 자신의 생일 정보를 숨기고있을 것입니다. – Ron

답변

2

당신은

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

나는 이미 내 함수에있다 : \t function getFacebookFriends ($ criteria = '') { \t \t $ name = $ criteria [ 'name']; \t \t \t \t if ($ name == '') $ name = 'me'; \t \t \t \t $ url = 'https://graph.facebook.com/'.$name.'/friends?access_token='.$this-> getAccessToken(); \t \t $ content = @file_get_contents ($ url, 0, null, null); \t \t $ content = json_decode ($ content, true); \t \t \t \t $ users = $ this-> formatFacebookUsers ($ content); \t \t \t \t return $ users; \t} – user1755741

+0

내 코드에 무슨 문제가있는 것 같습니까? 제발 도와주세요. 감사합니다. – user1755741

+0

그냥 친구를 사는데 사용됩니다. for 루프에서 access_token 매개 변수가없는 또 다른 그래프 API 요청을 작성 중입니다. access_token 매개 변수를 사용하여 모든 그래프 api 호출 .. – aykut

관련 문제