check-in with api facebook com php sdk

Asked

Viewed 880 times

0

I wonder if anyone has managed to implement facebook check-in in a php system.

<?php
header("Content-type: text/html; charset=UTF-8");
// datetimezone
date_default_timezone_set('America/Sao_Paulo');

// habilita erros do php
ini_set('display_errors', true);

// autoloader gerado pelo composer
require_once __DIR__ . "/vendor/autoload.php";

// APP Config
define('APP_ID', '');
define('APP_SECRET', '');
define('APP_VERSION', 'v2.8');

// instancia do facebook
$fb = new Facebook\Facebook([
    'app_id'     => APP_ID,
    'app_secret' => APP_SECRET,
    'default_graph_version' => APP_VERSION
]);

// access token
$accessToken = '';

try {

    // dados para envio da publicacao no feed
    $feed_data = array(
        "message" => "LOJA!", 
        "place" => "140262660539",
    );  

    $response = $fb->post('/me/feed', $feed_data, $accessToken); 
    $graphNode = $response->getGraphNode();
    echo 'ID da Postagem: ' . $graphNode['id'];

} catch(Facebook\Exceptions\FacebookResponseException $e) {
    echo 'Graph returned an error: ' . $e->getMessage();
    exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
    echo 'Facebook SDK returned an error: ' . $e->getMessage();
    exit;
}
  • Welcome to OS Max, are you having any specific mistakes with the SDK? Edit the question by specifically saying where is the problem that it becomes easier to help.

  • my problem is that I can’t checkin does not show the location, error #200 appears from the facebook api. what is missing?

  • I made an implementation first log with facebook and then is forwarded to the page fb-checkin.php.... further presents the following error: Facebook SDK returned an error: You must provide an access token.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.