public static function get($name, $limit) { if (!$name) { return false; } $api = new FBAPI(); $results = $api->graph($name, 'photos'); // @todo figure out what to do with exceptions. Log them using SS_Log::log()? if ($results instanceof FBAPI_Exception) { return false; } // return false when there's no data if (empty($results['data'])) { return false; } $output = new DataObjectSet(); $count = 0; foreach ($results['data'] as $record) { if ($limit && $count >= $limit) { break; } $output->push(new FBPhoto($record)); $count++; } return $output; }
/** * Return Facebook events for the given username with a limit. * * @param string $name Facebook username to get events from * @param int $limit Number of events to get * @param array Query parameters to filter events e.g. "since" => "yesterday" (future events) or "until" => "yesterday" (past events) */ public static function get($name, $limit, $query = array()) { $api = new FBAPI(); $results = $api->graph($name, 'events', $query); if ($results instanceof FBAPI_Exception) { return false; } // return false when there's no data if (empty($results['data'])) { return false; } $output = new DataObjectSet(); $count = 0; foreach ($results['data'] as $record) { if ($limit && $count >= $limit) { break; } // we have to do another request to get the detail of the event. $detail = $api->graph($record['id']); $record = array_merge($record, $detail); $output->push(new FBEvent($record)); $count++; } return $output; }
<?php include "FBAPI.php"; $eu = new FBAPI("CAACEdEose0cBALVKsolUhLAnjVSDINZAs2lwkbo7VKCMJEaoB2ZCZAoQr4CrPuJHerwWO0aTrFMDAeAO9lACadrKrqfW3tljQnDEuZBZAJhl7MdPOX1sT7wwJyIZAKnRwo3P3kg8hZAClAU3jc6wMRhw6w3p6vSLZBd5ZA9iqt7IZAeR5hRdzMc2wwe834CSwVwZCpSGThMDsgIlrCvPKo5CmUTSifit4jZAdGoZD"); print_r(json_decode($eu->load('')));
public static function set_access_token($token) { self::$access_token = $token; }