title: Two ways of loging in Facebook using php?
body: <p>I'm really confused about loging in facebook.
  It seems that there are two ways of loging in one is the way that shows on the facebook <a href="https://developers.facebook.com/docs/howtos/login/server-side-login/" rel="nofollow">howtos page</a>:</p>
  
  <p>And the other is by using this code: </p>
  
  <pre><code>require_once('facebook.php');
  session_start();
  $config = array(
      'appId' =&gt; "xxxxxxx",
      'secret' =&gt; "xxxxxxxxxxxxx"
  );
  
  $facebook = new Facebook($config);
  $user_id = $facebook-&gt;getUser();
  
  if ($user_id) 
  {
     try 
     {
          echo $user_id;
     }
     catch (FacebookApiException $e) 
     {
           $login_url = $facebook-&gt;getLoginUrl();
            echo 'Please &lt;a href="' . $login_url . '"&gt;login.&lt;/a&gt;';
      }
  } 
  else 
  {
     $login_url = $facebook-&gt;getLoginUrl();
     echo 'Please &lt;a href="' . $login_url . '"&gt;login.&lt;/a&gt;';
  }
  </code></pre>
  
  <p>Which one is the best?
  What are the cons and pros for each method?
  If I use the first one, can I instanciate a facebook object in order to perform my graph api calls without having to append the access token on the graph url?</p>
  
  <p>Thank you.</p>