public
Last active

Use FBAutopost wrapper class to publish to a fan page.

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?php
try {
$fb = facebook_autopost();
$fb
->setDestination($facebook_page_id)
->publish(array(
'type' => 'status',
'params' => array('message' => t('Hello world.')),
));
}
catch (ErrorException $e) {
drupal_set_message($e->getMessage(), 'error');
}
?>

This should call the factory function facebook_autopost() instead of instantiating FBAutopost directly.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.