Created
February 19, 2015 18:26
-
-
Save niraj-shah/56bf50740a973950970d to your computer and use it in GitHub Desktop.
Getting started with the Facebook PHP SDK v4.1. Example of a POST request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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