You are here

function _facebook_pull_feed in Facebook Pull 7.3

Same name and namespace in other branches
  1. 6 facebook_pull.module \_facebook_pull_feed()
  2. 7 facebook_pull.module \_facebook_pull_feed()
  3. 7.2 facebook_pull.module \_facebook_pull_feed()

Pull data from a facebook feed.

1 call to _facebook_pull_feed()
_facebook_pull_feed_cached in ./facebook_pull.module
Pull data from a facebook feed and cache it.

File

./facebook_pull.module, line 287
Facebook Pull Module for getting content from Facebook graph.

Code

function _facebook_pull_feed($graph_id, $type, $token, $options = array()) {
  $qs = http_build_query($options, '', '&');
  $url = "https://graph.facebook.com/%s/%s?%s&%s";
  $full_url = sprintf($url, $graph_id, $type, $token, $qs);
  $raw = drupal_http_request($full_url);
  $raw = $raw->data;
  $data = json_decode($raw);
  if (!isset($data->data)) {
    $message = 'Failed to fetch data from the Facebook Graph';
    $variables = array();
    watchdog('facebook_pull', $message, $variables, WATCHDOG_WARNING);
    return FALSE;
  }
  return $data->data;
}