views:

16

answers:

0

Hi! I create facebook application names

http://apps.facebook.com/mysapp/

and i need to implement facebook library to get uid from user.

my code is

require_once('inc/_facebook_library.php');

    $facebook = new Facebook(array(
      'appId'  => 'APPID',
      'secret' => 'SECRET',
      'cookie' => true,
    ));

    $session = $facebook->getSession();

    $me = null;
    // Session based API call.
    if ($session) {
      try {
        $uid = $facebook->getUser();
        $me = $facebook->api('/me');
        echo $uid;
      } catch (FacebookApiException $e) {
        echo 'sdsds';
        error_log($e);
      }
    }

I try to echo $uid; but it doesn't show. how i fix it. thanks!!