Skip to content

Instantly share code, notes, and snippets.

@mattcdavis1
Created July 8, 2013 18:58
Show Gist options
  • Save mattcdavis1/5951469 to your computer and use it in GitHub Desktop.
Save mattcdavis1/5951469 to your computer and use it in GitHub Desktop.
Get a facebook token and posts from a facebook page
<?php
$tokenUrl = 'https://graph.facebook.com/oauth/access_token?client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials';
$token = file_get_contents($tokenUrl);
$postsUrl = 'https://graph.facebook.com/{page_id or slug}/posts?' . $token;
$postsJson = file_get_contents($postsUrl);
$posts = json_decode($postsJson);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment