Last active
December 21, 2015 05:19
-
-
Save e0ipso/6256142 to your computer and use it in GitHub Desktop.
Use FBAutopost wrapper class to publish to the user's timeline (requires Facebook App approval).
This file contains 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 { | |
$fb = facebook_autopost(); | |
$fb | |
->setDestination('me') | |
->publish(array( | |
'type' => 'status', | |
'params' => array('message' => t('Hello world.')), | |
)); | |
} | |
catch (ErrorException $e) { | |
drupal_set_message($e->getMessage(), 'error'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should call the factory function facebook_autopost() instead of instantiating FBAutopost directly.