如何检查Facebook用户是否喜欢外部网站的FB页面 [英] How to check if a Facebook user liked an FB page from an external website

查看:181
本文介绍了如何检查Facebook用户是否喜欢外部网站的FB页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页显示Facebook LIKE Box ..我需要检查用户是否喜欢我的Facebook页面,并提供内容给他们相应..从我的外部网页做这个Facebook身份验证是完全正确的。

解决方案

您需要使用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

这篇关于如何检查Facebook用户是否喜欢外部网站的FB页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆