Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Created August 23, 2014 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save niraj-shah/65737247aa70c5c1d4c0 to your computer and use it in GitHub Desktop.
Save niraj-shah/65737247aa70c5c1d4c0 to your computer and use it in GitHub Desktop.
Get Page Access Token for a given Facebook Page. Using Facebook PHP SDK 4.0.x.
<?php
// get page access token
$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'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment