Can't check Facebook Places by mail on api?

I am trying to create an application where I allow a registered user to be able to register in places on Facebook. However, for some reason I cannot do this work. I suggested that this is possible with Api, since the recording functionality has been added to it, but I could not find a clear explanation on the Internet. this is what I have, after I asked the user to allow the publication of checks for user_checkins as well.

<?php require("src/facebook.php"); $facebook = new Facebook(array( 'appId' => 'xxxxxxxxx', 'secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'cookie' => true )); # see if active session $session = $facebook->getSession(); if(!empty($session)) { try{ $uid = $facebook->getUser(); $api_call = array( 'method' => 'users.hasAppPermission', 'uid' => $uid, 'ext_perm' => 'publish_checkins' ); $can_post = $facebook->api($api_call); if($can_post){ $facebook->api('/'.$uid.'/checkins', 'POST', array( 'access_token' => $facebook->getAccessToken(), 'place' => 'place_id', 'message' =>'I went to placename today', 'picture' => 'http://www.place.com/logo.jpg', 'coordinates' => array( 'latitude' => 'lattiude', 'longitude' => 'lattitude', 'tags' => $uid, ) ) ); echo 'You were checked in'; } else { die('Permissions required!'); } } catch (Exception $e){} } else { # There no active session,generate one $login_url = $facebook->getLoginUrl(); header("Location: ".$login_url); } ?> 

The code works when I change its 'checkins' to 'feed'. Something is wrong with my code, or I'm trying to do something that is impossible (or do it wrong).

Any help would be greatly appreciated, since I had already spent a lot of time trying to fix it, but I just can't get it to work.

Yours faithfully,

Marcus Joe

+6
php facebook facebook-graph-api
source share
2 answers

Your answer is almost correct.

 $facebook->api('/'.$uid.'/checkins', 'POST', array( 'access_token' => $facebook->getAccessToken(), 'place' => 'place_id', 'message' =>'I went to placename today', 'picture' => 'http://www.place.com/logo.jpg', 'coordinates' => json_encode(array( 'latitude' => 'lattiude', 'longitude' => 'lattitude', 'tags' => $uid), ) ) 

Note that for coordinates you must specify the json_encode variable. Hope that helps someone.

+10
source share

Just an update from Facebook:

NOTE. Publishing a Checkin object is deprecated in favor of creating Mail with an attached location.

You can see how to create a post with a location (or Facebook site id) here: http://developers.facebook.com/docs/reference/api/user/#posts

+1
source share

All Articles