function getTopFBPosts($account, $count = 10) { $start = tryGET('start'); $end = tryGet('end'); $token = getFBToken(); if (!isset($token[0])) { DoNotCache("Facebook: Authentication failed"); return null; } //No token $url = "https://graph.facebook.com/{$account}/posts"; $params = array($token[0] => $token[1], "limit" => 100, "fields" => "likes.limit(1).summary(true),shares,actions", "since" => $start, "until" => $end); $result = getAPI($url, $params); if (!isset($result->data)) { return array(); } $rdata = $result->data; usort($rdata, 'fbSort'); $posts = array(); foreach ($rdata as $key => $p) { if ($key < $count) { array_push($posts, $p); } else { break; } } return $posts; }
function fbStats($id) { $token = getFBToken(); $url = "https://graph.facebook.com/{$id}"; $params = array($token[0] => $token[1]); $info = getAPI($url, $params); if (isset($info->curl_error)) { return null; } return array("followers" => $info->likes); }