Facebook Graph API session expiration

Home - Facebook Graph API session expiration

Girly Saputri Staff asked 3 years ago

I use the following PHP code to publish random messages from my database to my Facebook fan page:

$appid = 'MY_APP_ID';
$appsecret = 'APP_SECRET';
$pageid = 'MY_PAGE_ID';
$token = 'MY_ACCESS_TOKEN';

// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => $appid,
  'secret' => $appsecret,

$message = 'Hello World';

//Information that makes up the facebook page post
$attachment = array(
        'access_token' => $token,
        'message' => $message

//Try to post to the facebook page
$res = $facebook->api('/'.$pageid.'/feed','POST',$attachment);

} catch (Exception $e){

    echo $e->getMessage();

And here is src/facebook.phphttps://github.com/facebook/facebook-php-sdk/blob/master/src/facebook.php
But it return the error message something like this:

Your Answer