Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 11th, 2012  |  syntax: None  |  size: 0.59 KB  |  views: 213  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. http://www.facebook.com/my_page_name
  2. http://www.facebook.com/pages/my_page_name
  3. http://www.facebook.com/my_page_ID
  4.        
  5. identifier = url.substring(url.lastIndexOf("/"))
  6. graphUrl = "https://graph.facebook.com/" + identifier
  7. urlJsonData = getGraphData(graphUrl)
  8.        
  9. url = http://www.facebook.com/southpark
  10.        
  11. url = http://www.facebook.com/6708787004
  12.        
  13. <?php
  14.  
  15. function getFacebookId($url) {
  16.  
  17.     $id =  substr(strrchr($url,'/'),1);
  18.  
  19.     $json = file_get_contents('http://graph.facebook.com/'.$id);
  20.  
  21.     $json = json_decode($json);
  22.  
  23.     return $json->id;
  24.  
  25. }
  26.  
  27.  
  28. echo getFacebookId($_GET['url']);
  29.  
  30.  
  31. ?>
clone this paste RAW Paste Data