Skip to content

Instantly share code, notes, and snippets.

@geraldvillorente
Last active January 14, 2018 12:39
Show Gist options
  • Save geraldvillorente/d6ad9ab2fdf83408a2d8d7966b0b1a41 to your computer and use it in GitHub Desktop.
Save geraldvillorente/d6ad9ab2fdf83408a2d8d7966b0b1a41 to your computer and use it in GitHub Desktop.
FB PHP
$fb = new \Facebook\Facebook([
        'app_id' => 'xxx',
        'app_secret' => 'xxx',
        'default_access_token' => 'xxx',
        'default_graph_version' => 'v2.11',
]);

try {
        $response = $fb->post(
            '/' . $fb_page_id . '/feed', array(
                'message' => 'This is a test message',
            ),
            'xxx'
        );

}
catch(Facebook\Exceptions\FacebookResponseException $e) {
        echo 'Graph returned an error: ' . $e->getMessage();
        exit;
}
catch(Facebook\Exceptions\FacebookSDKException $e) {
        echo 'Facebook SDK returned an error: ' . $e->getMessage();
        exit;
}
$graphNode = $response->getGraphNode();

Error:

Graph returned an error: (#200) Requires either publish_actions permission, or manage_pages and publish_pages as an admin with sufficient administrative permission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment