Skip to content

Instantly share code, notes, and snippets.

@srinathweb
Forked from niraj-shah/fb_php_sdk_4.1_post.php
Last active August 29, 2015 14:19
Show Gist options
  • Save srinathweb/7d135731c2f010ce0758 to your computer and use it in GitHub Desktop.
Save srinathweb/7d135731c2f010ce0758 to your computer and use it in GitHub Desktop.
<?php
try {
// Be sure to ask for the publish_actions permission first
// If you provided a 'default_access_token', third parameter '{access-token}' is optional.
$response = $fb->post( '/me/feed', [
'name' => 'Facebook API: Using the Facebook PHP SDK v4.1.x',
'link' => 'https://www.webniraj.com/2015/02/19/facebook-api-using-the-facebook-php-sdk-v4-1-x/',
'caption' => 'As version v4.1 of the Facebook PHP SDK nears release (at time of writing), I though this would be a good time to explain how the new version works. Migrating your application from v4.0.x to v4.1.x will break your application.',
'message' => 'Check out my new blog post!',
] );
} catch( Exception $e ) {
// catch any errors and halt script
echo $e->getMessage();
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment