Possible Duplicate:
Implication of Facebook offline_access deprecation
I am posting this problem here because I couldn't find an answer anywhere for my specific case.
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.
This script has worked great until 10 days ago, now we get the following error when we call the script manually:
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
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.
Here is the token format we have been using so far:
$fanpagetoken = '<REMOVED ACCESS TOKEN FROM TEXT>';
And here is the PHP code we are using for posting on our wall:
#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' => $appid,
'secret' => $secret,
));
$attachment = array(
'access_token' => $fanpagetoken,
'message' => "Sheet Music Showcase for ".$day.":",
'name' => $headline,
'caption' => "Showcase Expiration: $deadline",
'link' => 'http://www.ourwebsite.com/s/'.$createsession,
'description' => 'View the complete high quality PDF sheet music file, listen to related audio files and more!',
'picture' => 'http://www.virtualsheetmusic.com/images/icons/new_downloadsHome/'.$mainid.'.gif',
'actions' => array(array('name' => 'Learn more...',
'link' => 'http://www.virtualsheetmusic.com/s/'.$createsession))
);
$result = $facebook->api('/oursitefanpage/feed/',
'post',
$attachment);
How to generate a new token in that format?
Any help is very welcome!
Thank you in advance for any thoughts
Best, Fab.