As social networks gain more and more ground customers are often confronted with the task of integrating their sites with Facebook, Twitter, Google+, etc. While developing a website recently we were asked to establish the cross-posting of the customer site with a Facebook public page. The relevant desk-top research having been done (Facebook's API and the existing tools for Drupal integration investigated), we eventually bookmarked a method which we are going describe in this post.
Secondly, you will have to create an application in Facebook to establish connection between it and the customer site. For this, a package of Drupal for Facebook modules will have to be Installed and configured. Though, the latter lacks the public pages posting function, it nevertheless has many useful functions and modules that help fulfill various tasks related to Drupal integration with Facebook.
/** * Auto publish facebook. */ function internetdevels_autopublish_facebook($params) { if ($fb = _fb_api_init()) { try { $page_info = $fb->api('/' . FB_PAGE_ID . '?fields=access_token'); $params['access_token'] = $page_info['access_token']; $fb->api('/' . FB_PAGE_ID . '/feed', 'POST', $params); } catch (FacebookApiException $e) { drupal_set_message(t('Not published to Facebook')); } } }