CakePHP and Facebook Plugin: read user checkins
-
27-10-2019 - |
Question
I am using CakePHP and Nick Baker's Facebook Plugin, and I am trying to retrieve a certain user's checkins. The problem is that I have quite no idea on how to do this. There is nothing related to checkins in the plugin's documentation. All I have is the api()
method which I don't know how to use.
I have this so far:
App::import('Lib', 'Facebook.FB');
$FB = new FB();
$this->set('checkins', $FB->api('https://graph.facebook.com/'.$this->Connect->user('id').'/checkins'));
but the checkins
variable contains only this:
Array
(
[id] => https://graph.facebook.com/1000005215732xx/checkins
)
But have no idea on how to continue. Also, after I retrieve the checkins, I would like to search whether a user has checked in in a specified place. I will be glad for any help you can give! Thank you!
Solution
The api()
method only takes a URL relative to the API endpoint, so you should be calling:
$result = $FB->api('/<uid>/checkins');
Also, make sure you have the proper permissions, especially user_checkins
.