0

I am trying to post dynamic data to facebook wall.
I downloaded facebook api for php.

First of all, as for testing, I use below code.

<?php
  // Remember to copy files from the SDK's src/ directory to a
  // directory in your application on the server, such as php-sdk/
  require '../src/facebook.php';



$config = array(
    'appId'  => 'myAPPID',
    'secret' => 'MySecretCode'
);

//'access_token' => $access_token = $facebook->getAccessToken(), 

$facebook = new Facebook($config);
$attachment =  array(
                    'access_token' => 'my_tokenkey', 
                                    'message' => 'Test Message offline test message',
                                    'name' => 'Name Test offline test...',
                                    'description' => 'here goes description and links http:anotherfeed.com | http://facebook.com/anotherfeed',
                                    'caption' => 'this is caption for action link',
                                    'picture' => 'http://www.google.com/tv/images/slivetv.png',
                                    'link' => 'www.yahoo.com',
                                        'properties' => array(
                                        array('text' => 'test link 1', 'href' => 'http://anotherfeed.com/?ref=1'),
                                        array('text' => 'test link 1', 'href' => 'http://anotherfeed.com/?ref=1'),
                                        ),  
);

try {
    $facebook->api('/me/feed', 'POST', $attachment);
} catch(FacebookApiException $e) {
    echo $e;
    # handling facebook api exception if something went wrong
}


?>

As for my program requirement, I want my program to post data to facebook's wall whether facebook is online or offline.

But when I try this code, I get error.

OAuthException: An active access token must be used to query information about the current user.

Could anyone please give me suggestions?

Frank Myat Thu
  • 4,448
  • 9
  • 67
  • 113
  • to be honest, there are so many questions posted on SO with this exception, I can't even post them all here .. – dbf Sep 13 '12 at 14:49
  • 1
    https://developers.facebook.com/roadmap/offline-access-removal/, https://developers.facebook.com/blog/post/2011/05/13/how-to--handle-expired-access-tokens/ – CBroe Sep 13 '12 at 15:10

0 Answers0