$appId, 'secret' => $secret, 'cookie' => true, )); $redirect_url = $facebook->getLoginUrl(array('canvas' => 1, 'fbconnect' => 0, 'next' => $start_page )); // We may or may not have this data based on a $_GET or $_COOKIE based session. // // If we get a session here, it means we found a correctly signed session using // the Application Secret only Facebook and the Application know. We dont know // if it is still valid until we make an API call using the session. A session // can become invalid if it has already expired (should not be getting the // session back in this case) or if the user logged out of Facebook. $user = $facebook->getUser(); if (empty($user)) { echo ""; die(); } $me = null; // Session based API call. if ($user) { try { $me = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); } } // login or logout url will be needed depending on current user state. if ($me) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } $friends = $facebook->api('/me/friends'); //var_dump($friends); ?> php-sdk

php-sdk

Login :