[英]tagging list of friends in facebook api
First I get my friend list, select 5 friends and try to tag them in a status update. 首先,我得到我的朋友列表,选择5个朋友,然后尝试在状态更新中为他们添加标签。 However, nothing posts.
但是,没有任何帖子。 i'm sure the error is here { tags: tags } or tags += + friend["id"] + ",";
我确定错误在这里{标签:标签}或标签+ = +朋友[“ id”] +“,”; I'm trying to separate each ID wit ha comma and put the whole thing under the tags variable
我试图用逗号分隔每个ID,然后将整个内容放在标签变量下
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);
});
});
}
In order for your problem to be resolved you should add all parameters to the POST body. 为了解决您的问题,您应该将所有参数添加到POST正文中。
Example: 例:
FB.api("/me/feed", "post", { place: "132738745815", tags: tags, message: "look here", access_token: "<?php echo $tkn;?>" }, function(response) {
commenter(commentsLeft);
});
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.