You are here

function _facebook_pull_feed in Facebook Pull 7.2

Same name and namespace in other branches
  1. 6 facebook_pull.module \_facebook_pull_feed()
  2. 7.3 facebook_pull.module \_facebook_pull_feed()
  3. 7 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 276
Default cache time.

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";
  $fullurl = sprintf($url, $graph_id, $type, $token, $qs);
  $raw = file_get_contents($fullurl);
  $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;
}