显示没有按钮的Facebook喜好

显示没有按钮的Facebook喜好,facebook,facebook-like,Facebook,Facebook Like,我试图在Facebook上显示我喜欢的人的数量,但没有他们丑陋的按钮。有没有一种方法可以在没有任何图片的情况下获取喜欢的数量,这样我就可以将css应用于喜欢的数量,并将其显示在我的主网页上 开发人员页面似乎没有任何帮助,我可以找到 谢谢 向图形API发出http请求: {您的页面名称或id} 它将返回一个包含此页面信息的json对象。您可以在浏览器上测试它。例如: 返回: { "id": "40796308305", "name": "Coca-Cola", "picture

我试图在Facebook上显示我喜欢的人的数量,但没有他们丑陋的按钮。有没有一种方法可以在没有任何图片的情况下获取喜欢的数量,这样我就可以将css应用于喜欢的数量,并将其显示在我的主网页上

开发人员页面似乎没有任何帮助,我可以找到


谢谢

向图形API发出http请求:

{您的页面名称或id}

它将返回一个包含此页面信息的json对象。您可以在浏览器上测试它。例如:

返回:

{
   "id": "40796308305",
   "name": "Coca-Cola",
   "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/174560_40796308305_2093137831_s.jpg",
   "link": "https://www.facebook.com/coca-cola",
   "likes": 45669549,
   "cover": {
      "cover_id": "10151829640053306",
      "source": "http://a8.sphotos.ak.fbcdn.net/hphotos-ak-ash3/s720x720/529413_10151829640053306_446360541_n.jpg",
      "offset_y": 0
   },
   "category": "Food/beverages",
   "is_published": true,
   "website": "http://www.coca-cola.com",
   "username": "coca-cola",
   "founded": "1886",
   "description": "Created in 1886 in Atlanta, Georgia, by Dr. John S. Pemberton, Coca-Cola was first offered as a fountain beverage at Jacob's Pharmacy by mixing Coca-Cola syrup with carbonated water. \n\nCoca-Cola was patented in 1887, registered as a trademark in 1893 and by 1895 it was being sold in every state and territory in the United States. In 1899, The Coca-Cola Company began franchised bottling operations in the United States. \n\nCoca-Cola might owe its origins to the United States, but its popularity has made it truly universal. Today, you can find Coca-Cola in virtually every part of the world.",
   "about": "The Coca-Cola Facebook Page is a collection of your stories showing how people from around the world have helped make Coke into what it is today.",
   "checkins": 106,
   "talking_about_count": 671246
}
它还适用于个人资料(返回的信息不同)、应用程序和任何facebook对象! 这只返回公共信息。如果要检索私有信息(可能是图片或帖子),需要获取OAuth令牌并将其传递给Graph API

如果需要更多信息,请查看OAuth并打开开发者帮助中的Graph API。(https://developers.facebook.com/docs/opengraph/tutorial/)


我自己开的。请记住,使用cronjob执行此操作并将其存储在数据库中,因为它非常慢。

这太棒了。我现在的问题是关于JSON的。我是如何告诉我的网站获取这些信息的?我知道JSON,但我只是在学习。JSON是Javascript对象的文本表示。基本上有两种方法可以访问此信息,一种是使用javascript从浏览器访问,另一种是从服务器访问。Javascript有一个重要的限制,它只允许从您自己的域访问资源。您可以:1)使用JS FacebookAPI(一开始有点复杂)或2)在服务器上发布一个PHP脚本,其作用类似于获取此数据的代理,并使用jQuery.ajax(“yourserver.com/proxy.PHP?url=…”,函数(data){…处理数据…});谢谢你的建议。你的方式看起来比上面的建议更容易管理,但是我不确定什么是“cronjob”。也许我比我想象的更像个傻瓜。你介意详细介绍一下这个想法吗?这是在您返回JSON数据之后吗?很抱歉这么晚才发表评论。它让你每分钟、每小时、每一天、每一周自动执行一次脚本,诸如此类。它在后台执行此操作,然后您可以将值保存到数据库中,并从数据库中选择这些值以将其回显到页面中。通过这种方式,您可以更快地为用户提供页面服务。
$pageContent = file_get_contents('http://graph.facebook.com/YOURPAGENAMEHERE');
$parsedJson  = json_decode($pageContent);
$likes = $parsedJson->likes;
echo $likes;