facebook post on page wall - PHP SDK

535 views Asked by At

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): enter image description here

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

There are 1 answers

0
CBroe On BEST ANSWER

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