title: Error validating access token: Session has expired at unix time
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/9798085/implication-of-facebook-offline-access-deprecation">Implication of Facebook offline_access deprecation</a>  </p>
  </blockquote>
  
  
  
  <p>I am posting this problem here because I couldn't find an answer anywhere for my specific case.</p>
  
  <p>I have created a server-side PHP app that posts/showcases automatically on our FB fan page every week a link to one of our products, randomly.</p>
  
  <p>This script has worked great until 10 days ago, now we get the following error when we call the script manually:</p>
  
  <pre><code>Fatal error: Uncaught OAuthException: Error validating access token: Session has expired at unix time 1355862507. The current unix time is 1356217401. thrown in /home/webadmin/virtualsheetmusic.com/html/facebook/API/base_facebook.php on line 1249
  </code></pre>
  
  <p>Now, I have figured out that the problem is in the passed access_token, but I can't find out how to generate a new one in the format I am using with this application.</p>
  
  <p>Here is the token format we have been using so far:</p>
  
  <p><code>$fanpagetoken = '&lt;REMOVED ACCESS TOKEN FROM TEXT&gt;';</code></p>
  
  <p>And here is the PHP code we are using for posting on our wall:</p>
  
  <pre><code>    #Define vars...
  $day = strtotime($today);
  $day = date("l, F j, Y", $day);
  
  $deadline = strtotime("+1 week");
  $deadline = date("l, F j, Y", $deadline);
  
  // Create our Application instance (replace this with your appId and secret).
  
  
  $facebook = new Facebook(array(
    'appId'  =&gt; $appid,
    'secret' =&gt; $secret,
  ));
  
  
  
  $attachment = array(
                      'access_token' =&gt; $fanpagetoken,
  
                      'message' =&gt; "Sheet Music Showcase for ".$day.":",
                      'name' =&gt; $headline,
                      'caption' =&gt; "Showcase Expiration: $deadline",
                      'link' =&gt; 'http://www.ourwebsite.com/s/'.$createsession,
                      'description' =&gt; 'View the complete high quality PDF sheet music file, listen to related audio files and more!',
                      'picture' =&gt; 'http://www.virtualsheetmusic.com/images/icons/new_downloadsHome/'.$mainid.'.gif',
                      'actions' =&gt; array(array('name' =&gt; 'Learn more...', 
                                        'link' =&gt; 'http://www.virtualsheetmusic.com/s/'.$createsession))
                      );
  
  
  $result = $facebook-&gt;api('/oursitefanpage/feed/',
                              'post',
                              $attachment);
  </code></pre>
  
  <p>How to generate a new token in that format?</p>
  
  <p>Any help is very welcome!</p>
  
  <p>Thank you in advance for any thoughts</p>
  
  <p>Best,
  Fab.</p>