Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Posting to a Page using Facebook PHP SDK v4.0.x and Graph API v2.x
// post to page
$page_post = (new FacebookRequest( $session, 'POST', '/'. $page_id .'/feed', array(
'access_token' => $access_token,
'name' => 'Facebook API: Posting As A Page using Graph API v2.x and PHP SDK 4.0.x',
'link' => '',
'caption' => 'The Facebook API lets you post to Pages you administrate via the API. This tutorial shows you how to achieve this using the Facebook PHP SDK v4.0.x and Graph API 2.x.',
'message' => 'Check out my new blog post!',
) ))->execute()->getGraphObject()->asArray();
// return post_id
print_r( $page_post );

This comment has been minimized.

Copy link

@minhvn minhvn commented May 18, 2016

How to get $session above?
I want only post to page wen have papgeid vs access token.
Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.