meco

get page data from facebook

Dec 5th, 2011
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.28 KB | None | 0 0
  1. $pageID = "ID of Page"
  2. $url = "https://graph.facebook.com/". $pageID ."/feed";
  3. $json = file_get_contents($url);
  4. $jsonData = json_decode($json);
  5.  
  6. foreach($jsonData->data as $val) {
  7.     if($val->from->id == $pageID) {
  8.         $message = $val->message;
  9.         echo $message;
  10.         break;
  11.     }
  12. }
  13.  
  14.  
Advertisement
Add Comment
Please, Sign In to add comment