title: Facebook Graph API session expiration
body: <p>I use the following PHP code to publish random messages from my database to my Facebook fan page:</p>
  
  <pre><code>require_once('src/facebook.php');
  $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'  =&gt; $appid,
    'secret' =&gt; $appsecret,
  ));
  
  $message = 'Hello World';
  
  //Information that makes up the facebook page post
  $attachment = array(
          'access_token' =&gt; $token,
          'message' =&gt; $message
  );
  
  //Try to post to the facebook page
  try{
  $res = $facebook-&gt;api('/'.$pageid.'/feed','POST',$attachment);
  
  } catch (Exception $e){
  
      echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>And here is <code>src/facebook.php</code> - <a href="https://github.com/facebook/facebook-php-sdk/blob/master/src/facebook.php" rel="nofollow">https://github.com/facebook/facebook-php-sdk/blob/master/src/facebook.php</a> </p>
  
  <p>But it return the error message something like this:</p>
  
  <pre><code>Error validating access token: Session has expired at unix time 1339020000. The current unix time is 1339022625.
  </code></pre>
  
  <p>So my question is what  changes should I do in my code ?</p>
  
  <p>P.S: I also looked relevant questions about session expiration, but none of them helped me.</p>
  
  <p>Thanks in advance.</p>