How can i get the Facebook page like count without login?

血红的双手。 提交于 2019-12-10 13:38:20

问题


I need to get the facebook page like count without user login. I want to show the count on my webpage. I don't want an FB Button, need to show the count only. I saw that several people are using graph api, But I think it requires an accesstoken, so it also required to login by the user. I don't want that kind of stuffs. Guys help me with a solution. I will also trying, if I get a solution before, will comment here.


回答1:


This would be the API call:

https://graph.facebook.com/[page-id]?fields=name,fan_count&access_token=[any-access-token]

The response (JSON):

{
  "name": "xxx",
  "fan_count": 216,
  "id": "xxx"
}

About Tokens in general:

  • https://developers.facebook.com/docs/facebook-login/access-tokens/
  • http://www.devils-heaven.com/facebook-access-tokens/



回答2:


GET Request + Regex

To get pages likes you can perform GET request to this Facebook link with your page:

http://www.facebook.com/plugins/fan.php?connections=100&id={PAGE_ID}

and then find the like count with regex.



来源:https://stackoverflow.com/questions/39085030/how-can-i-get-the-facebook-page-like-count-without-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!