facebook离线时Facebook发布墙数据(access_token = staticValue)

时间:2012-09-13 14:46:38

标签: php facebook facebook-graph-api

我正在尝试将动态数据发布到Facebook墙上 我下载了facebook api for php。

首先,至于测试,我使用下面的代码。

<?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
}


?>

至于我的节目要求,我希望我的程序将数据发布到Facebook的墙上,无论Facebook是在线还是离线。

但是当我尝试这段代码时,我会收到错误。

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

有人可以给我一些建议吗?

0 个答案:

没有答案