作为APPLICATION用户发布到Facebook应用页面 [英] Post to Facebook application page as APPLICATION user

查看:89
本文介绍了作为APPLICATION用户发布到Facebook应用页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用

  $ app_id ='ID OF MY APPLICATON'
$ facebook-> api($ app_id。'/ feed','POST',array '=>'test'));

在帖子写完后,我的名字显示出来,但是我想要将应用程序名称替换为我的名字显示,这是否可以做?

解决方案

应用页与粉丝页一样工作,所以你只要做同样的事情好像你想通过粉丝专页发表



信息在这里 - http://www.masteringapi.com/tutorials/how-to- post-on-facebook-page-as-page-not-as-admin-user-using-php-sdk / 31 /



关键是在页面中使用access_token,而不是用户帐户的access_token

  $ result = $ facebook-> api( /我/账户); 
foreach($ result [data] as $ page){
if($ page [id] == $ page_id){
$ page_access_token = $ page [access_token ]。
break;
}
}
$ args = array(
'access_token'=> $ page_access_token,
'message'=>我是一页!
);
$ post_id = $ facebook-> api(/ $ page_id / feed,post,$ args);


I'd like to write a status message to my application page with the application name.

I'm using

$app_id = 'ID OF MY APPLICATON'
$facebook->api($app_id.'/feed', 'POST', array('message' => 'test'));

after the post is written my name is shown but I want instead of my name the application name to be shown, is this possible to do?

解决方案

App pages work the same as fan pages, so you'd just do the same as if you wanted it posted by a fan page

Info here - http://www.masteringapi.com/tutorials/how-to-post-on-facebook-page-as-page-not-as-admin-user-using-php-sdk/31/

The key is to use an access_token from the page, not the access_token of your user account

$result = $facebook->api("/me/accounts");
foreach($result["data"] as $page) {
    if($page["id"] == $page_id) {
        $page_access_token = $page["access_token"];
        break;
    }
}
$args = array(
    'access_token'  => $page_access_token,
    'message'       => "I'm a Page!"
);
$post_id = $facebook->api("/$page_id/feed","post",$args);

这篇关于作为APPLICATION用户发布到Facebook应用页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆