Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require './src/facebook.php';
- $facebook = new Facebook(array(
- 'appId' => 'YourAppId',
- 'secret' => 'YourAppSecret',
- 'cookie' => true, // enable optional cookie support
- ));
- try {
- $user = $facebook->getUser();
- } catch (FacebookApiException $e) {
- $user = null;
- }
- if($user){
- try {
- $me = $facebook->api('/me?fields=id,name,first_name,permissions');
- }catch (FacebookApiException $e){
- $thiserrorResult = $e->getResult();
- if(isset($thiserrorResult[error][code]) && $thiserrorResult[error][code]=='2500' ){
- // we need to reauth
- $facebook->destroySession();
- // do redirect here, or show login button
- }
- }
- }
- ?>
- <!DOCTYPE html>
- <html>
- <head><title></title></head>
- <body>
- Add javascript sdk here.
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement