retnuh
retnuh

Reputation: 600

Facebook session query

Since I have just started working with Facebook's api I had a few questions regarding Facebook sessions. In the index of my iFrame app I have the user establish a new sessions and set the $me and $uid variables as displayed in their example.

However, when my app navigates to a new page should I create a new session and redeclare these variables or is there some way to grab those values from the already declared session?

Thanks

Upvotes: 0

Views: 155

Answers (1)

haha
haha

Reputation: 1532

Avoid facebook API call as much as possible.

session_start();
$me = $facebook->api('/me');
$_SESSION['user'] = $me;

print_r($_SESSION['user']);

as long as user not log out you can use this session. make sure destroy the $_SESSION['user'] on $facebook->getLogoutUrl()

Upvotes: 1

Related Questions