facebook fql检索评论

时间:2011-06-25 19:15:58

标签: facebook facebook-fql

显示在我的页面中发布的每个人的评论

这是空白页

我哪里出错

  FB.api({
  method: 'fql.multiquery',
  queries: {
   query1: 'SELECT post_fbid, fromid, text, time FROM comment WHERE post_id="'+postID     +'"',
  query2: 'SELECT id, name, url, pic FROM profile WHERE id IN (SELECT fromid FROM #query1)'
 }
 });
</script>
<script>
function(response) {

var comments = response[0].fql_result_set;
var users = response[1].fql_result_set;    

//loop through the comments
for(var i = 0, j = comments.length; i<j; i++){

    for(var x = 0, y = users.length; x<y; x++){
         if(comments[i].fromid == users[x].id){
             //we have a match, this comment is from user users[x]
             //process users[x]
             //break the inner for loop, since we already have a match
         }
    }

}

}     

1 个答案:

答案 0 :(得分:2)

您使用的是新Facebook评论(“已迁移”)吗?

或许可以考虑使用图形API:

https://graph.facebook.com/comments/?ids=http://example.com/