Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1. <?php
  2. try{
  3.     include_once "./lib/facebook.php";
  4. }catch(Exception $o){
  5.     echo '<pre>';
  6.     print_r($o);
  7.     echo '</pre>';
  8. }
  9.  
  10. $facebook = new Facebook(array(
  11.   'appId'  => $appid, //kontrol et buraları
  12.   'secret' => $secret, //kontrol et buraları
  13.   'cookie' => true
  14. ));
  15.  
  16. $session = $facebook->getSession();
  17.  
  18. $loginUrl = $facebook->getLoginUrl(
  19.         array(
  20.         'canvas'    => 1,
  21.         'fbconnect' => 0,
  22.         'req_perms' => 'email,publish_stream,user_photos,user_photo_video_tags,friends_photos,friends_photo_video_tags'                                //user_relationships,friends_relationships,user_relationship_details,friends_relationship_details
  23.         )
  24. );
  25.  
  26. if (!$session){
  27.     echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
  28.     exit;
  29. }else{
  30.     try {
  31.         $uid      =   $facebook->getUser();
  32.         $fbme     =   $facebook->api('/me?fields=id,first_name,last_name,picture,name,gender,email');
  33.     }catch(FacebookApiException $e){
  34.         echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
  35.         exit;
  36.     }
  37. }
  38.  
  39.  
  40. print_r($fbme);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement