title: How get facebook user ID from my application?
body: <p>I created a facebook application and send request to a user through below code.Now when a user allow my application then i need his id and email address into my canvas url.But on that below code user don't go to my canvas URL.So,Please help me to solve ,how a user go to my canvas url when he allow my application and i get the user id of that user?My code is below:</p>
  
  <blockquote>
    <p>require_once 'facebook.php';<br>
    $facebook = new Facebook(array(<br>
    'appId'  => '#######',<br>
    'secret' => '###################',<br>
    'cookie' => true, ));<br>
    $req_perms = "publish_stream,offline_access,user_status,email,read_stream";</p>
    
    <p>$session = $facebook->getSession();</p>
    
    <p>$loginUrl = $facebook->getLoginUrl(array('canvas'=>1,'fbconnect' => 0,'req_perms'=>$req_perms));<br>
    $me = null;</p>
    
    <p>if (!$session) 
        { echo "top.location.href= '$loginUrl';";exit;} </p>
    
    <p>else{</p>
  
  <pre><code> try {
          $uid    =   $facebook-&gt;getUser();
          $me     =   $facebook-&gt;api('/me');
       } 
   catch (FacebookApiException $e) 
     { echo "&lt;script type='text/javascript'&gt;top.location.href= '$loginUrl';&lt;/script&gt;"; exit;}
  }
  </code></pre>
  </blockquote>
  
  <p>So,please help me to get the user id.</p>
  
  <blockquote>
    <p>Thanks in advance</p>
    
    <p>riad</p>
  </blockquote>