0
我使用臉譜圖API獲取我的朋友的詳細信息。我想要一個特定的用戶ID如後能得到朋友的細節,我有4個朋友使用臉譜圖API後的特定ID獲得朋友
uid name
1 Rob
2 Ryan
3 Bob
4 Angelina
現在我想用戶ID後能得到朋友的詳細信息的用戶ID 3,4等的2種手段。
我用下面的圖搜索查詢
$url = 'https://graph.facebook.com/'.$user.'/friends?uid>=2';
但似乎並不奏效。我搜查了很多,但沒有任何信息。有限制的選項,但沒有選擇執行我想要的。對此有何幫助?下面是我完整的代碼
function getFacebookFriends_more($criteria='') {
$name = $criteria['name'];
$load_me_more_id = $criteria['load_more_id'];
if($name=='') $name = 'me';
$url = 'https://graph.facebook.com/'.$name.'/friends?uid>='.$load_me_more_id.'fields=gender,name&access_token='.$this->getAccessToken();
$content = $this->getDataFromUrl($url);
$content = json_decode($content,true);
$users = $this->formatFacebookUsers_more($content,$load_me_more_id);
return $users;
}
function formatFacebookUsers_more($content,$load_me_more_id) {
for($i=0; $i<count($content['data']); $i++) {
$id = $content['data'][$i]['id'];
$name = $content['data'][$i]['name'];
$gender = $content['data'][$i]['gender'];
$url = 'http://www.facebook.com/profile.php?id='.$id;
$picture = 'https://graph.facebook.com/'.$id.'/picture?type=large'; //square, small, large
$users[$i]['id'] = $id;
$users[$i]['name'] = $name;
$users[$i]['picture'] = $picture;
$users[$i]['url'] = $url;
$users[$i]['gender'] = $gender;
}
return $users;
}
讓我貼我的完整代碼,我保存它,但它似乎並不奏效仍然 – user1001176
我粘貼完整代碼可能你請看看並指導我 – user1001176
請參閱我上面的編輯@ user1001176 –