2011-08-26 103 views
0

我使用的是Facebook PHP SDK 3.1.1,一個iFrame應用程序可以發佈在已登錄的用戶牆上,已經是該頁面的粉絲。Facebook iFrame應用程序PHP SDK 3.1.1 - 發佈在牆上

以下是安科,這讓我錯誤「致命錯誤:未捕獲OAuthException:(#200)的用戶無權執行此操作中拋出的應用程序」

/*post starts*/ 
$attachment = array('message' => 'test message', 
'name' => 'test app!', 
'caption' => "Caption of the Post", 
'link' => 'http://apps.facebook.com/phpsdk_demoapp/', 
'description' => 'It is fun!', 
'picture' => 'http://www.takwing.idv.hk/facebook/demoapp_phpsdk/img/logo.gif', 
'actions' => array(array('name' => 'Start Learning', 
'link' => 'http://www.takwing.idv.hk/tech/fb_dev/index.php')) 
); 

$result = $facebook->api('/me/feed/', 
'post', 
$attachment); 
/*post ends*/ 

我猜的部分必須獲得用戶的許可才能在牆上發佈信息,敬請諒解。 感謝

+2

很明顯,您是在不理解以下內容的情況下複製文章或論壇中的代碼。我建議你先閱讀基礎知識([認證](http://developers.facebook.com/docs/authentication/)和[圖api])(https://developers.facebook.com/docs/reference/api/ )) – ifaour

回答

0

用戶訪問之前,您的應用程序,你必須去的牆後的用戶權限。這可以通過以下方式實現:

http://www.facebook.com/dialog/oauth?client_id=" . <your app id> . "&redirect_uri=" . <app redirect url> . "&scope=publish_stream,offline_access' 

這將使您可以訪問用戶牆上的帖子。

相關問題