且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查Facebook用户是否喜欢外部网站的FB页面

更新时间:2023-12-01 18:56:16

您需要使用Graph API并检查用户的喜好。这是一个例子。

  https://graph.facebook.com/ {USER_ID} / likes / {PAGE_ID} 

如果用户喜欢有问题的页面,如果用户喜欢该页面,它将返回JSON。

  {
data:[
{
name:bread&
category:餐厅/咖啡厅,
id:157758372652,
created_time:2012-02-15T15:36:38 + 0000
}
],
分页:{
next:https://graph.facebook.com/me/likes/157758372652?format=json&limit = 5000& offset = 5000& __ after_id = 157758372652
}
}

如果用户不喜欢这个页面,就像这样:

  {
data:[
]
}

以下是用户喜欢的文档:
https://developers.fa cebook.com/docs/reference/api/user/#likes


I have a web page which displays Facebook LIKE Box.. I need to check if a user liked my Facebook page or not and present contents to them accordingly.. doing Facebook authentication for this from my external web page is perfectly fine..

You need to use the Graph API with and check the User's likes. Here is an example.

https://graph.facebook.com/{USER_ID}/likes/{PAGE_ID}

If the user likes the page in question, it will return JSON looking like this if the user likes the page.

{
  "data": [
    {
      "name": "bread&cup", 
      "category": "Restaurant/cafe", 
      "id": "157758372652", 
      "created_time": "2012-02-15T15:36:38+0000"
    }
  ], 
  "paging": {
    "next": "https://graph.facebook.com/me/likes/157758372652?format=json&limit=5000&offset=5000&__after_id=157758372652"
  }
}

And like this if the user doesn't like the page:

{
  "data": [
  ]
}

Here's the documentation on User likes: https://developers.facebook.com/docs/reference/api/user/#likes