dslfq06464 2018-01-17 17:14 采纳率: 0%
浏览 39

一个PHP文件发布到我的页面

I have a script to post updates to our website to our facebook page as well. I created an API for this, got all the app_id's and such and added my facebook profile as both admin on the facebook page and added a manager role on the APP as well.

I read it wasn't necessary to get the APP reviewed by FaceBook if you're not publishing the app anywhere. This is not a website other people can use to post content, it's merely an admin tool to let us post our updates on our facebook page.

I post run my test post with this code (ID's removed):

$fb = new \Facebook\Facebook( [
  'app_id'                => APP_ID,    
  'app_secret'            => APP_SECRET,
  'default_graph_version' => 'v2.2',
  'default_access_token'  => DEFAULT_ACCESS_TOKEN
] );


$attachment = [
    'message' => 'this is a test message',
];

try{
    $result = $fb->post( '419661214806422/feed', $attachment );
} catch( Exception $e ){
    echo "<pre>" . print_r( $e, true ) . "</pre>";
}

This gives me an error message: (#200) Requires either publish_actions permission, or manage_pages and publish_pages as an admin with sufficient administrative permission. I don't know where to edit my permissions though. My account is the admin for the facebook page, and it has also been added as manager of the APP I'm writing. I tried searching on the web all afternoon, but I can only find information about APPs actually open to the public, which is something I don't need. I therefor can also not give a link to facebook for reviewing, since this is part of our admin.

  • 写回答

1条回答 默认 最新

  • duanchun1909 2018-01-17 17:22
    关注

    Where are you getting your default access token from? You can debug your token here https://developers.facebook.com/tools/debug/accesstoken. It will tell you the permissions yuo have. During the auth flow, you would need to have granted those permissions to your app in order to post.

    评论

报告相同问题?

悬赏问题

  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备
  • ¥15 echarts动画效果的问题,请帮我添加一个动画。不要机器人回答。
  • ¥15 Attention is all you need 的代码运行