0

我刚刚设置了一个很好的方法来获取通过 FB 的评论社交插件在我的网站上发表的评论,使用 PHP 和 OpenGraph/FQL 请求(我没有使用 Facebook SDK)。

我需要它在相关的 iOS 应用程序中显示评论。实际上,此方法检索所有评论,如果存在相关答案,以及有关发表评论的用户的用户名/图片。

问题来自与另一个提供商签署的用户发表的评论。FQL 结果为:

  "fromid": XXXXXXXXXXXXXXX,          //first ID, usually is uid in "user" table
  "text": "comment text", 
  "time": 1345979042, 
  "comments": {
    "data": [
      {
        "id": "YYYYYYYYYYYYYYYYYY",   //not relevant, URL id
        "from": {
          "name": "externaluser", 
          "id": ZZZZZZZZZZZZZZZ      //another ID, usually uid too, different from XXXXX 
        }, 
        "message": "test reply", 
        "created_time": 1345979528
      }
    ], 
    "count": 1
  }

此结果正确地给出了注释文本,但 ID 不存在于用户表中。“回复”正确返回名称“externaluser”,但我无法在任何查询 FQL 表的地方找到它。

我确信这个外部用户存储在 Facebook 数据库中的某个地方!有人可以指出我检索用户数据的正确关系吗?

谢谢你。

4

2 回答 2

0

We ran into the same issue and finally found a FQL query that gives us the names of the people making comments. When pulling data from the stream, there were actually two sets of names that we needed, the names of the people posting to the stream and the names of the commenters. A triple query was needed to get the data. Its a rather large query, so I've cut it down to only the relevant fields.

{"q1":"SELECT source_id, likes, comments, actor_id,  post_id FROM stream WHERE filter_key IN ( SELECT filter_key FROM stream_filter WHERE uid = me())",
 "q2":"SELECT id, username, name FROM profile WHERE id IN (SELECT actor_id FROM #q1)",
 "q3":"SELECT id,name,username FROM profile WHERE id IN (SELECT fromid FROM comment WHERE post_id IN (SELECT post_id FROM #q1))"}

Query 1 gives you the items from the stream. Query 2 gives you the information for the people that posted to the stream. You'll need to do a cross reference from actor_id in q1 to id in q1. Query 3 gives you the information for the people that commented on anything returned in q1. You'll need to do a cross reference from formid in q1.comments.comment_list to id in q1.

Hope this helps.

于 2013-03-05T14:53:19.503 回答
0

你可以试试这个 FQL:

SELECT id, name, username FROM user WHERE third_party_id = ZZZZZZZZZZZZZZZ

如果这不能让您接触到用户,那么我认为您将无法从 FB 服务器获取该详细信息。

于 2012-08-26T13:23:22.330 回答