开发者

post a feed on my facebook application fan page

开发者 https://www.devze.com 2023-02-08 19:02 出处:网络
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 appHe

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


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!"));
0

精彩评论

暂无评论...
验证码 换一张
取 消