Search Results

Search found 1 results on 1 pages for 'zany'.

Page 1/1 | 1 

  • Facebook - Publish Checkins using Graph API

    - by Zany
    I'm trying to publish Checkin using Facebook Graph API. I've gone through Facebook API documentation (checkins) and also have the publish_checkins permission. However, my checkin is not getting published. May I know is there anything wrong or am I missing anything else? Thank you for your time :) fbmain.php $user = $facebook->getUser(); $access_token = $facebook->getAccessToken(); // Session based API call if ($user) { try { $me = $facebook->api('/me'); if($me) { $_SESSION['fbID'] = $me['id']; $uid = $me['id']; } } catch (FacebookApiException $e) { error_log($e); } } else { echo "<script type='text/javascript'>top.location.href='$loginUrl';</script>"; exit; } $loginUrl = $facebook->getLoginUrl( array( 'redirect_uri' => $redirect_url, 'scope' => status_update, publish_stream, publish_checkins, user_checkins, user_location, user_status' ) ); main.php (Updated: 18/6/2012 11.12pm) <?php include_once "fbmain.php"; if (!isset($_POST['latitude']) && !isset($_POST['longitude'])) { ?> <html> <head> //ajax POST of latitude and longitude </head> <body> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({ appId: '<?php echo $facebook->getAppID() ?>', cookie: true, xfbml: true, oauth: true, frictionlessRequests: true }); FB.Canvas.setAutoGrow(); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; document.getElementById('fb-root').appendChild(e); }()); </script> ... <input type="button" value="Check In!" onclick="checkin(<?=$facebook?>);"/></span> </body> </html> <?php } else { print_r($_POST['latitude']); print_r($_POST['longitude']); ?> <script type="text/javascript"> // not using latitude and longitude to test function checkin($fb) { try { $tryCatch = $facebook->api('/'.$_SESSION['fbID'].'/checkins', 'POST', array( 'access_token' => $fb->getAccessToken(), //corrected 'place' => '165122993538708', 'message' =>'I went to placename today', 'coordinates' => json_encode(array( 'latitude' => '1.3019399200902', 'longitude' => '103.84067653695' )) )); } catch(FacebookApiException $e) { $tryCatch=$e->getMessage(); } return $tryCatch; } </script> <?php } ?>

    Read the article

1