简体   繁体   English

在墙上的Facebook帖子-PHP SDK

[英]facebook post on page wall - PHP SDK

I'm trying to create a script that post on a facebook page (as an administrator) a status. 我正在尝试创建一个脚本,该脚本在Facebook页面上(以管理员身份)发布状态。 This is the script i'm using: 这是我正在使用的脚本:

try {
    $access_token = (new FacebookRequest( $session, 'GET', '/' . $pageID,  array( 'fields' => 'access_token' ) ))
        ->execute()->getGraphObject()->asArray();

    $access_token = $access_token['access_token'];

    $page_post = (new FacebookRequest( $session, 'POST', '/'. $pageID .'/feed', array(
        'access_token' => $access_token,
        'message' => $message,
      ) ))->execute()->getGraphObject()->asArray();
} catch (FacebookRequestException $e) {
    echo 'ERROR! ' . __LINE__ . $e->getMessage();   
} catch (Exception $e) {
    echo 'ERROR! ' . __LINE__ . $e->getMessage();
}

The script does work, and I see the post on facebook (ignore language): 该脚本确实有效,我在facebook上看到了该帖子(忽略语言): 在此处输入图片说明

The problem is that I'm the only one who can see this post. 问题是,我是唯一可以看到此帖子的人。 When other users enter the page, they can't see the post, and if I give them the post's url, it says that it doesn't exist. 当其他用户进入页面时,他们将看不到该帖子,如果我给他们提供该帖子的url,则表明该URL不存在。

You need to make your app public, on top of Status&Review tab in app dashboard. 您需要在应用信息中心的“状态与评论”标签顶部将应用公开。

As long as an app is in development mode, everything it “creates” on Facebook is only visible to app admins/developers/testers. 只要应用程序处于开发模式,它在Facebook上“创建”的所有内容仅对应用程序管理员/开发人员/测试人员可见。

(This does not require to submit your app for review, since you will only be using it yourself. Only if you wanted to ask other users for permissions as well, you'd need to submit those for review.) (这不需要提交您的应用程序进行审阅,因为您只能自己使用它。只有当您也想向其他用户请求权限时,才需要将其提交进行审阅。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM