Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook ID from URL

Tags:

facebook

Given a facebook url such as http://facebook.com/cnn, is there any way to get the ID of that page short of scraping it?

like image 328
drewh Avatar asked Jan 25 '11 01:01

drewh


People also ask

What is FB ID URL?

Find your facebook ID in two easy steps Your Facebook personal profile URL is the the URL you get to when you click on your name in the upper right of the facebook home page. It should look something like this: https://facebook.com/zuck. https://www.facebook.com/profile.php?id=100001533612613.


2 Answers

It is better (and legal) to do this with graph API. Just perform API request to https://graph.facebook.com/cnn and get id from the response.

Here is the response for cnn:

{
   "id": "5550296508",
   "name": "CNN",
   "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs178.ash2/41813_5550296508_728_s.jpg",
   "link": "http://www.facebook.com/cnn",
   "category": "Company",
   "website": "www.cnn.com\nwww.ireport.com\n",
   "username": "cnn",
   "company_overview": "TRIVIA FROM THE CNN TOUR...",
   "products": "CNN US...",
   "likes": 1689936
}
like image 117
zerkms Avatar answered Oct 24 '22 20:10

zerkms


Facebook's own Graph API supports it. From the documentation:

The "ids" query parameter also accepts URLs. This is useful for finding IDs of URLs in the Open Graph. For example: https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/

like image 31
Tomer Gabel Avatar answered Oct 24 '22 19:10

Tomer Gabel