Some of the features in Facebook Graph API requires a special kind of tokens called “app access token“. Features like Facebook Test Accounts and Facebook Insights make use of this token.

So how to obtain a Facebook Application access_token?
This can be easily achieved using file_get_contents():


$token_url =	"" .
				"client_id=" . $APPLICATION_ID .
				"&client_secret=" . $APPLICATION_SECRET .
$app_token = file_get_contents($token_url);
Back to top
  • Pingback: Introduction To Facebook Test Users Accounts With PHP-SDK | API? Yes Master!

  • Pingback: How To: Handle Application Requests Using The Facebook Graph API | API? Yes Master!

  • yanipan

    seems easy when  you show it like that :)

  • sohchai

    even simpler if using graph api

    $access_token = $facebook->getAccessToken();

    • Michael Panneman

      Not the same token afaik

  • Sjnilanr

    not working

  • titi

    Those whom it’s not working for, check your php.ini to allow fopen of url.

  • Bas Taller

    Looks like currently it works as simple as 

  • Yondri

    Really helpfull, thanks.

  • Jas

    thank you.

  • Ashely Hills

    do you have the code for android to perform the same task?

  • Sam Choudhary

    not working screen is blank