问题
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