title: resolving Fatal error: Call to undefined method Facebook::getSession() during facebook authentication
body: <p>i am currently working on facebook connect login page for my web page.</p>
  
  <p>but i keep receiving 'call to undefined method' error message at line 24:</p>
  
  <pre><code>$session = $facebook-&gt;getSession();
  </code></pre>
  
  <p>when i remove line 24 everything seems to run smoothly .</p>
  
  <p>ut as i am following a tutorial at <a href="http://www.9lessons.info/2011/01/facebook-graph-api-connect-with-php-and.html" rel="noreferrer">http://www.9lessons.info/2011/01/facebook-graph-api-connect-with-php-and.html</a> and <a href="http://net.tutsplus.com/tutorials/php/how-to-authenticate-your-users-with-facebook-connect/" rel="noreferrer">http://net.tutsplus.com/tutorials/php/how-to-authenticate-your-users-with-facebook-connect/</a> - its kinda left me stumped!</p>
  
  <p>the error message is</p>
  
  <pre><code>Fatal error: Call to undefined method Facebook::getSession() in C:\xampp\htdocs\kite\index.php on line 24 
  </code></pre>
  
  <p>please help. many thanks in advance. here is my code:</p>
  
  <pre><code>&lt;?php session_start();
  
      //config
      include "resources/Connections/kite.php";
  
      //connect to the database so we can check, edit, or insert data to our users table
      $con = mysql_connect($hostname_kite, $username_kite, $password_kite) or die(mysql_error());
      $db = mysql_select_db($database_kite, $con) or die(mysql_error());
  
      //include out functions file giving us access to the protect() function made earlier
      include "resources/php/functions.php";
  
      //setup facebook connect
      require 'resources/facebook/src/facebook.php';
      $facebook = new Facebook(array(
        'appId'  =&gt; $appid_kite,
        'secret' =&gt; $secret_kite,
      ));
  
      // Get User ID
      $user = $facebook-&gt;getUser();
  
      // Let's see if we have an active session
      $session = $facebook-&gt;getSession();
  
      // We may or may not have this data based on whether the user is logged in.
      //
      // If we have a $user id here, it means we know the user is logged into
      // Facebook, but we don't know if the access token is valid. An access
      // token is invalid if the user logged out of Facebook.
  
      if ($user) {
        try {
          // Proceed knowing you have a logged in user who's authenticated.
          $user_profile = $facebook-&gt;api('/me');
        } catch (FacebookApiException $e) {
          error_log($e);
          $user = null;
        }
      }// Login or logout url will be needed depending on current user state.
      if ($user) {
        $logoutUrl = $facebook-&gt;getLogoutUrl();
      } else {
        $loginUrl = $facebook-&gt;getLoginUrl();
      }
      ob_start();
      ?&gt;
  </code></pre>