Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get page_id from facebook url

my question is how get facebook page_id starting from a simple fb url. For example:

  • http://www.facebook.com/vanityurl
  • http://www.facebook.com/pages/pagename/pageid

Actually if the url match the string "facebook.com/pages/" I call:

  • https://graph.facebook.com/pageid

else I call:

  • https://graph.facebook.com/vanityurl

This approach seems to work well, but it is really empirical and looking at documentation I don't see any suggestion.
What do you think about?

like image 636
freedev Avatar asked Oct 03 '11 17:10

freedev


2 Answers

Simple Instructions:

  1. Go to the desired Facebook page
  2. Ctrl + U to view Page Source
  3. Ctrl + F to open a search dialog box
  4. Using the search dialog box, search "page_id=" in the code
  5. The 'page_id' should follow the "=" symbol

TEST:

Search for the desired page using the 'page_id' in place of the page name:

www.facebook.com/[insert 'page_id' here]

like image 142
user13681447 Avatar answered Nov 13 '22 06:11

user13681447


I'm not quite sure what you're asking but I think what you're talking about is trying to get the id of a page that you only know by its "vanity url" or "nickname".

Basically you can do a facebook graph api request to the "vanity url" and then grab the id from the provided request.

For example... if you open the Facebook graph API explorer https://developers.facebook.com/tools/explorer?method=GET&path=coca.cola.

or make a request to http://graph.facebook.com/coca.cola

you can see in the response you get "id": "40796308305" which is the page ID you are talking about.

Navigating to http://www.facebook.com/40796308305 should prove that.

Hope that helps.

like image 45
dawogfather Avatar answered Nov 13 '22 06:11

dawogfather