0

I know this has been asked and answered before, but I can't find any answers that are for the newer Facebook v2.3 API.

I've set up the script to post to a managed page I am an administrator to, I've got my graph api all working and I can post to my own timeline with no problems, but posting to a managed page I appear to be posting it as me posting to another page:

Jim shared a link to Awesome Company's Timeline.

What I'm really trying to do is post as the page.

Does anyone know how to do this in the new API?

Here's a snip of my code so far:

$page_id = xxxxxxxxxxxxxxx;


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

// save access token in variable for later use  
$access_token = $access_token['access_token'];

$page_post = (new FacebookRequest( $session, 'POST', '/'. $page_id .'/feed', array(
    'access_token' => $access_token,
    'name' => 'A Name',
    'link' => 'http://www.example.com',
    'caption' => 'Testing the facebook api',
    'message' => 'Check out our latest news post!',
  ) ))->execute()->getGraphObject()->asArray();

// return post_id
print_r( $page_post );
jimbeeer
  • 1,604
  • 2
  • 12
  • 25
  • I've heard this is an issue with the facebook API ever since they merged businesses and accounts into a single unified account. I'd be interested to know the answer as well. – James Spence Apr 29 '15 at 17:18
  • Just use the a page access token. You can get one by calling me/accounts – WizKid Apr 29 '15 at 17:34
  • Why is there no handling of possible exceptions the API/the SDK might throw in your code? – CBroe Apr 29 '15 at 17:38
  • I'm already using the page access token aren't I? – jimbeeer Apr 30 '15 at 08:46
  • Does passing access_token to FacebookRequest override the access token already in use in the session? Have you confirmed that the page access token exists and can be used manually? – Igy May 04 '15 at 17:33

0 Answers0