Facebook Checkins on Website
I have a website that has users regularly ch开发者_高级运维ecking in to with Facebook. I want to display the currently checked in users (name & avatar) on the homepage. I've managed to achieve this for people checking in with foursquare but can't work out how to do it with Facebook.
As far as I can tell checkins are extended permissions and require an access token. I've managed to generate an Access token using...
echo $token = file_get_contents('https://graph.facebook.com/oauth/access_token?client_id=[-APP ID-]&client_secret=[-APP SECRET-]&grant_type=client_credentials');
and appending the result to a checking request...
echo file_get_contents('https://graph.facebook.com/[-PAGE ID-]/checkins/?'.$token);
but all I get from that is:
400 Bad Request
I don't want visitors to the site to have to login to facebook & grant permissions to see checked in users... I just want to list account names and pictures.
Is this possible or am I dreaming?
Facebook does not allow you to see the checkins to a place unless the current user is friends with the person checked in.
https://graph.facebook.com/[-PAGE ID-]/checkins/?access_token=$token
will give you all the current users friends who have checked into [-PAGE ID-]
.
Did you mean:
echo file_get_contents('https://graph.facebook.com/[-PAGE ID-]/checkins/?access_token='.$token);
You forgot ?access_token=
精彩评论