Skip to content

Instantly share code, notes, and snippets.

@drainpip
Created May 13, 2013 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drainpip/5572519 to your computer and use it in GitHub Desktop.
Save drainpip/5572519 to your computer and use it in GitHub Desktop.
Class that returns array of Facebook Graph information.
<?php
class facebook_graph_json
{
public function query($page_username) {
$url = file_get_contents('http://graph.facebook.com/'.$page_username);
$json = json_decode($url);
return array(
'page_name' => $json->name,
'page_id' => $json->id,
'page_url' => $json->link,
'page_fans' => $json->likes,
'talking_about' => $json->talking_about_count,
'about' => $json->about,
'founded' => $json->founded,
'can_post' => $json->can_post,
'website' => $json->website
);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment