基本上这就是我想做的事情
- Get all my likes (page likes)
- Get all my friends
- for each of my friends, get their likes
- for each of their likes, do something
现在,我这样做的方法是使用JS SDK,因为我已经尝试过PHP SDK并且它非常慢(如此慢,以至于最大执行时间的PHP错误开始) ,PHP SDK总是比JS慢吗?我的脚本是这样的:
var newArray = [];
FB.api('me/likes', function(response){
FB.api('me/friends', function(friends){
$(friends).each(function(){
FB.api(this.uid+'/likes', function(fr_likes){
$(fr_likes).each(function(){
//save this friend likes to newArray
newArray.push(this);
});
});
});
});
});
//call newArray outside FB scope doesn't work at first
console.log(newArray); //returns [] / empty
但是如果我在一段时间后使用chrome控制台来调用newArray,那么newArray会慢慢填充FB数据。
所以我的问题是:
感谢您的回答