PHP SDK de Open Graph de Facebook

Si el otro día comentaba la nueva API de Open Graph de Facebook, ahora encuentro una librería que nos permite trabajar de forma sencilla con esta API:

include_once 'lib/facebook.php';
include_once 'config.php';
$facebook = new Facebook(array(
  'appId'  => FACEBOOK_API_KEY,
  'secret' => FACEBOOK_SECRET_KEY,
  'cookie' => true,
  'domain' => 'phpfour.com'
));
$session = $facebook->getSession();
if (!$session) {
  $url = $facebook->getLoginUrl(array(
    'canvas' => 1,
    'fbconnect' => 0
  ));
  echo "";
} else {
  try {
    $uid = $facebook->getUser();
    $me = $facebook->api('/me');
    $updated = date("l, F j, Y", strtotime($me['updated_time']));
    echo "Hello " . $me['name'] . "
"; echo "You last updated your profile on " . $updated; } catch (FacebookApiException $e) { echo "Error:" . print_r($e, true); } }

PHP-SDK Facebook

Vía / Md Emran Hasan

Similar Posts

3 Comments

Comments are closed.