2011-08-26 135 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' 

这将使您可以访问用户墙上的帖子。

相关问题