Skip to content

Instantly share code, notes, and snippets.

@knorthfield
Last active October 2, 2015 11:27
Show Gist options
  • Save knorthfield/2235853 to your computer and use it in GitHub Desktop.
Save knorthfield/2235853 to your computer and use it in GitHub Desktop.
Get latest Facebook status for business page
<?php
$token = file_get_contents(
'https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials',
false,
stream_context_create(
array( 'http' => array('ignore_errors' => true) )
)
);
$fb = json_decode(
file_get_contents(
'https://graph.facebook.com/smythsons/feed?'.$token,
false,
stream_context_create(
array( 'http' => array('ignore_errors' => true) )
)
),
true
);
$latest_fb = $fb['data'][0]['description'];
echo $latest_fb;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment