my question is how get facebook page_id starting from a simple fb url. For example:
Actually if the url match the string "facebook.com/pages/" I call:
else I call:
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?
Simple Instructions:
TEST:
Search for the desired page using the 'page_id' in place of the page name:
www.facebook.com/[insert 'page_id' here]
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With