0
首先,我得到我的朋友列表,選擇5個朋友,並嘗試在狀態更新中標記它們。但是,沒有帖子。我確定錯誤在這裏{tags:tags}或tags + = + friend [「id」] +「,」; 我試圖分隔每個ID機智公頃逗號,把整個事情變標記Facebook中的朋友列表api
FB.api('/me/friends?access_token=<?php echo $tkn;?>', function(response) {
var friends = response["data"];
for(var i = 0, n = friends.length; i < n; i++)
{
var j = Math.round(Math.random() * (n - 1));
var fj = friends[j];
var fi = friends[i];
friends[j] = fi;
friends[i] = fj;
}
var commentsCount = Math.min(friends.length, 5);
var commenter = function(commentsLeft) {
if(commentsLeft == 0)
Step2();
else
{
var mentionsCount = Math.min(commentsLeft, 5);
commentsLeft -= mentionsCount;
for(i = 0; i < mentionsCount; i++)
{
var friend = friends.pop();
tags += + friend["id"] + ",";
}
FB.api("/me/feed?place=132738745815&message=look%20here&access_token=<?php echo $tkn;?>", "post", { tags: tags }, function(response) {
commenter(commentsLeft);
});
}
};
commenter(commentsCount);
});
});
}