title: Why am I getting a "the page isn't redirecting properly" error?
body: <p>I got this from nettuts, can someone please tell me why am I getting a "the page isn't redirecting properly" error? </p>
  
  <pre><code>&lt;?php
  # We require the library
  require("facebook.php");
  
  # Creating the facebook object
  $facebook = new Facebook(array(
      'appId'  =&gt; 'APP_ID_HERE',
      'secret' =&gt; 'APP_SECRET_HERE',
      'cookie' =&gt; true
  ));
  
  # Let's see if we have an active session
  $session = $facebook-&gt;getUser();
  
  if(!empty($session)) {
      # Active session, let's try getting the user id (getUser()) and user info (api-&gt;('/me'))
      try{
          $uid = $facebook-&gt;getUser();
  
          # req_perms is a comma separated list of the permissions needed
          $url = $facebook-&gt;getLoginUrl(array(
              'req_perms' =&gt; 'email,user_birthday,status_update,publish_stream,user_photos,user_videos'
          ));
          header("Location: $url");
      } catch (Exception $e){}
  } else {
      # There's no active session, let's generate one
      $login_url = $facebook-&gt;getLoginUrl();
      header("Location: ".$login_url);
  }
  </code></pre>