Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8096145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:21:46+00:00 2026-06-05T21:21:46+00:00

I’m trying to publish checkin using Facebook Graph API. I’ve gone through Facebook API

  • 0

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 – Using PHP SDK (Wrong SDK used in this example, should use JavaScript SDK instead)

<?php
    include_once "fbmain.php";

    if (!isset($_POST['latitude']) && !isset($_POST['longitude']))
    {
?>
<html>
    <head>
        //ajax POST of latitude and longitude
    </head>

    <body>
        <input type="button" value="Check In!" onclick="checkin();"/></span>
    </body>
</html>
<?php
}
else
{
?>
<script type="text/javascript">
    function checkin()
    {
        try
        {
            $tryCatch = $facebook->api('/'.$uid.'/checkins', 'POST', array(
                'access_token' => $facebook->getAccessToken(),
                'place' => '165122993538708',
                'message' =>'MESSAGE_HERE',
                'coordinates' => json_encode(array(
                    'latitude'  => '1.3019399200902',
                    'longitude' => '103.84067653695'
                ))
            ));
        }
        catch(FacebookApiException $e)
        {
            $tryCatch=$e->getMessage();
        }
        return $tryCatch;
    }
</script>
<?php
}
?>

Question solved – Things to take note when publishing checkin

  • Make sure publish_checkins permission is granted.
  • Must use json_encode() to encode coordinates parameter for PHP SDK.
  • place and coordinates parameters are compulsory.
  • A re-authentication is required if you have just added publish_checkins permission to your existing list of allowed permissions.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:21:47+00:00Added an answer on June 5, 2026 at 9:21 pm

    Apparently, the configuration and the PHP checkin function that I have posted in the question are correct. However, I should use JavaScript SDK instead of PHP SDK for my case as pointed out by Nehal. For future references…

    Using JavaScript SDK

    function checkin()
    {
        FB.api('/me/checkins', 'post', 
        { message: 'MESSAGE_HERE',
           place: 165122993538708,
           coordinates: {
               'latitude': 1.3019399200902,
               'longitude': 103.84067653695
           }
        },
            function (response) {
                alert("Checked in!");
            }
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.