post a feed on my facebook application fan page

2020-07-30 03:27发布

I know how to post something on my wall $facebook->api('/me/feed/', 'post', $feed); but how to post feed on my facebook application page and this feed must be posted by the app

1条回答
我欲成王,谁敢阻挡
2楼-- · 2020-07-30 03:56

Here you go:

// 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!"));
查看更多
登录 后发表回答