[英]How can I get all my friends profiles in a single request with the Facebook PHP SDK 3.0?
我正在嘗試檢索我的所有朋友,特別是我希望獲取每個朋友的位置信息(hometown_location和location),以便將它們放在地圖上。 我嘗試了下面的代碼,它會拋出一個錯誤:你請求的一些別名不存在:ids = 8689768,86576659,898676(etc)
$friends = $facebook->api("/$user/friends");
foreach($friends['data'] as $key => $friend) {
$friend_list .= ($key!=0) ? "," : "";
$friend_list .= $friend['id'];
}
$friend_profiles = $facebook->api("/ids=$friend_list");
有關如何實現這一目標的任何想法?
FQL查詢怎么樣:SELECT uid,name,hometown_location,current_location FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1 = me())
返回也是空值但沒有異常,還必須有一種通過FQL查詢過濾空值的方法
試試吧:
https://developers.facebook.com/tools/explorer
使用URL: https ://graph.facebook.com/fql?q = SERECT uid,name,hometown_location,current_location FROM user WHERE uid IN(SELECT uid2 FROM friend WHERE uid1 = me())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.