SHARE
TWEET

Untitled

a guest Nov 11th, 2012 255 Never
  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. ?>
RAW Paste Data
Top