title: Stuck using facebook php sdk. GetUser always returns 0
body: <p>I have got this code to login with the user if there is not anyone.</p>
  
  <p>index.php, located in <a href="http://DOMAIN.COM/PATH" rel="nofollow">http://DOMAIN.COM/PATH</a>.</p>
  
  <p>Here, if the user id returned is 0, the login url is taken from facebook instance and a redirection is made to that url to login with a facebook user. Then, after the authorize action, the next url iss "<a href="http://DOMAIN.COM/PATH/check.php" rel="nofollow">http://DOMAIN.COM/PATH/check.php</a>" where the "getUser" method is again executed, however, the user id is 0 again.</p>
  
  <p>`
      
  
  <pre><code>$fbPermissions = 'read_stream, publish_stream, user_birthday, user_location, user_work_history, user_hometown, user_photos';
  $site_url   = "http://DOMAIN.COM/PATH/check.php";
  $facebook = new Facebook(array(  
              'appId'  =&gt; 'MY_ID',  
              'secret' =&gt; 'MY_SECRET_ID',   
              'cookie' =&gt; true  
              ));  
  
  $user = $facebook-&gt;getUser(); 
  
  if($user) { 
  
      try{  
              echo "user id insid if=".$user;
              $user = $facebook-&gt;api('/me');  
      } catch (Exception $e){}  
  
  } else {  
      $loginUrl = $facebook-&gt;getLoginUrl(array('scope'=&gt;$fbPermissions,'redirect_uri'=&gt;$site_url));
      header('location:'.$loginUrl.'');
  } 
  ?&gt;
  </code></pre>
  
  <p>Code of check.php</p>
  
  <pre><code>&lt;?php
  include_once("facebook.php");
  
  $fbPermissions = 'read_stream, publish_stream, user_birthday, user_location, user_work_history, user_hometown, user_photos';
  $facebook = new Facebook(array(  
              'appId'  =&gt; 'MY_ID',  
              'secret' =&gt; 'MY_SECRET_ID',  
              'cookie' =&gt; true  
              ));  
  
  $user = $facebook-&gt;getUser(); 
  
  if($user) { 
  
      try{  
              echo "user id insid if=".$user;
              $user = $facebook-&gt;api('/me');  
      } catch (Exception $e){}  
  
  } else {  
      echo "No user";
  } 
  ?&gt;
  </code></pre>
  
  <p>Thus, in options in my app of facebook developers page, I have the "
  Site URL" option with this value "<a href="http://DOMAIN.COM/PATH/" rel="nofollow">http://DOMAIN.COM/PATH/</a>". I have had to create a Website platform in "configuration" section.</p>
  
  <p>I am working in a internet hosting not in localhost.</p>
  
  <p>Which can be the problem? I am really stuck</p>