PHP setSession

From Facebook Developer Wiki (
Jump to: navigation, search

The setSession method takes 2 arguments but neither are required. The first is the session array to set or a null value to blank out any session currently stored in the Facebook object. The second argument is whether to assign the change to the cookie (this will be ignored if cookies are disabled with the constructor or with .setCookieSupport()). The default value for the session array is null (deleting the session) and the default for the second argument is true (setting the cookie accordingly if cookie support is on).

Example of blanking out the current session:

 require 'facebook.php';

 $facebook = new Facebook(array(
   'appId'  => 'YOUR APP ID',
   'secret' => 'YOUR API SECRET',

 $facebook->setSession(null, true);
Personal tools
Graph API