Last active
August 29, 2015 14:05
-
-
Save bmarshall511/952edbe8a3c56d5353cc to your computer and use it in GitHub Desktop.
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 | |
| use Facebook\FacebookRequest; | |
| /** | |
| * Publish to User’s Timeline | |
| */ | |
| // Graph API to publish to timeline | |
| $request = (new FacebookRequest( $session, 'POST', '/me/feed', array( | |
| 'message' => 'I love articles on benmarshall.me!' | |
| )))->execute(); | |
| // Get response as an array, returns ID of post | |
| $response = $request->getGraphObject()->asArray(); | |
| print_r( $response ); | |
| // Graph API to publish to timeline with additional parameters | |
| $request = (new FacebookRequest( $session, 'POST', '/me/feed', array( | |
| 'name' => 'Facebook SDK PHP v4 — a complete guide!', | |
| 'caption' => 'Learn how to easily use the Facebook SDK PHP v4 library.', | |
| 'link' => 'http://www.benmarshall.me/facebook-sdk-php-v4', | |
| 'message' => 'Check out how to integrate Facebook with your website.' | |
| )))->execute(); | |
| // Get response as an array, returns ID of post | |
| $response = $request->getGraphObject()->asArray(); | |
| print_r( $response ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment