Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'sdk/facebook.php';
- $fb = new Facebook(array(
- 'appId' => 'APP_ID',
- 'secret' => 'SECRET_APP_ID',
- ));
- $user = $fb->getUser();
- if ($user) {
- try {
- $profile = $fb->api('/me');
- } catch (FacebookApiException $e) {
- error_log($e);
- $user = null;
- }
- }
- if($user) {
- $logoutUrl = $fb->getLogoutUrl();
- } else {
- $app_id = $fb->getAppID(); // id da app
- //seto as permissões app
- $loginUrl = $fb->getLoginUrl(
- array(
- "scope" => "email, user_photos, read_friendlist",
- "redirect_uri" => "https://www.facebook.com/pages/YOU_PAGE/ID_PAGE?sk=app_".$app_id
- ));
- die ('<script type="text/javascript">top.location.href="' . $loginUrl . '";</script>');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement