facebook post on page wall - PHP SDK

◇◆丶佛笑我妖孽 提交于 2019-12-31 01:11:47

问题


I'm trying to create a script that post on a facebook page (as an administrator) a status. 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):

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.


回答1:


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.

(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.)



来源:https://stackoverflow.com/questions/30875232/facebook-post-on-page-wall-php-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!