我有一個Facebook應用程序,我想用它來代表他們在我的客戶的Facebook Page Walls上發佈信息。我現在設置了它,以便當他們驗證我的應用程序時,我得到Access令牌,但是當我發佈到牆上時,出現以下錯誤:「OAuthException:驗證訪問令牌時出錯:會話無效,因爲用戶已登錄去「。發佈到Facebook主頁牆未登錄用戶
如何從我的腳本發帖而不登錄?
這裏是我的代碼:
include_once('fb-php-sdk/src/facebook.php');
$facebook = new Facebook(array(
'appId' => 'XXX',
'secret' => 'XXX',
));
try {
$page_id = '215133535279290'; //page id of the customer's facebook page
$args = array(
'access_token' => 'XXX', //access token received when user authenticated app
'message' => 'A test message'
);
$post_id = $facebook->api("/$page_id/feed","post",$args);
} catch (FacebookApiException $e) {
echo "Error:" . $e;
}
您需要在獲取令牌時詢問離線權限 – Ashley 2012-08-02 12:59:01
@Ashley https://developers.facebook.com/roadmap/offline-access-removal/ – Sammaye 2012-08-02 13:01:46