0

I'm creating a test app in facebook, so I'm trying to access to user info so I prompt the user accept window, when creating the $facebook->getSession() it shows me this error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /nfs/c05/h01/mnt/78225/domains/apps.royalworkshop.com/html/fb/index.php:2) in /nfs/c05/h01/mnt/78225/domains/apps.royalworkshop.com/html/fb/src/facebook.php on line 37

Fatal error: Call to undefined method Facebook::getSession() in /nfs/c05/h01/mnt/78225/domains/apps.royalworkshop.com/html/fb/index.php on line 14

Somebody knows how to solve this, I'm not a guru on servers or less... Thanks!

Jepser Bernardino
  • 1,331
  • 1
  • 12
  • 22

1 Answers1

2

change to $facebook->getUser(); instead. This is what is used in php-sdk 3.1.1. the most recent build. You may need to update. https://developers.facebook.com/docs/reference/php/


$user = $facebook->getUser();
if ($user) {
  try {
    // Proceed knowing you have a logged in user who's authenticated.
    $user_profile = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
    $user = null;
  }
}
ShawnDaGeek
  • 4,145
  • 1
  • 22
  • 39