check-in with api facebook with php sdk

0

I would like to know if someone has already managed to implement facebook check-in on 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;
}
    
asked by anonymous 16.02.2017 / 01:40

0 answers