我想找到與我最共同的朋友的朋友。Facebook最共同的朋友
public function topThreeMutualFriends() {
$count;
$query='select uid1 from friend where uid1 in (select uid2 from friend where uid1=me()) and uid2 in (Select uid2 from friend where uid1=me()) and uid1!=uid2';
$result = $this->api(array('query' => $query , 'method' => 'fql.query'));
if(!$result)
throw new exception("No Mutual Friends");
else{
foreach ($result as $uid)
$count[$uid['uid1']]++;
arsort($count, SORT_NUMERIC);
$i=0;
foreach($count as $key=>$uid){
$topthree[$i++]=$key;
if($i==3)break;
}
return array($topthree,$count);}
}
在上面的代碼拋出一個異常,指出:「這個API調用無法完成,由於資源限制」 我試圖讓所有的權限,查詢工作在FQL測試儀的罰款。 可能是什麼原因?
是的,這是完全正確的。我們有同樣的問題。具有> 100人的子選擇導致facebook經常只是放棄的負載。你需要將請求分割成幾部分,然後批處理,fql mutli查詢它們或者迭代循環。 – trcarden 2012-11-13 19:46:05