在我的Facebook应用程序粉丝页面上发布一个feed

时间:2011-02-07 09:39:41

标签: facebook facebook-graph-api facebook-php-sdk

我知道如何在我的墙上发布内容$facebook->api('/me/feed/', 'post', $feed); 但如何在我的Facebook应用程序页面上发布Feed并且此Feed必须由应用程序发布

1 个答案:

答案 0 :(得分:4)

你走了:

// we need to get an application access_token first
$token_url = "https://graph.facebook.com/oauth/access_token?" .
   "client_id=" . $app_id .
   "&client_secret=" . $app_secret .
   "&grant_type=client_credentials";
$app_token = file_get_contents($token_url);

// seperate the string returned to use it in the post array
$arr = explode("=",$app_token);
$app_token = $arr[1];

$post_id = $facebook->api("/$app_id/feed", "POST", array("access_token"=>$app_token,"message"=>"hello app!"));