0

Facebook ウォールに動的データを投稿しようとしています。
PHP用のFacebook APIをダウンロードしました。

まず、テストに関しては、以下のコードを使用します。

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

誰でも私に提案をお願いできますか?

4

0 に答える 0