开发者

How to get page id of a facebook page

开发者 https://www.devze.com 2023-04-12 01:49 出处:网络
I need to fetch page id of a facebo开发者_JAVA技巧ok page of a given URL in graph API. e.g this is the URL http://www.facebook.com/platform and I want to get the page id of this facebook page.

I need to fetch page id of a facebo开发者_JAVA技巧ok page of a given URL in graph API. e.g this is the URL http://www.facebook.com/platform and I want to get the page id of this facebook page. I tried all the possible solution but failed. Please any one help me....Please... Thanx!


The answers given before Oct 27, 2015 no longer work, and the other answer given after that is not dynamic, but requires site scraping. This answer provides the necessary URLs.

1) Get your App-id and App-secret by choosing an existing app or creating a new one at this url:

https://developers.facebook.com/apps/

2) Get an access token by making a GET request to this url:

https://graph.facebook.com/oauth/access_token?client_id=" + APP_ID + "&client_secret=" + APP_SECRET + "&grant_type=client_credentials

3) To get the page-id of your fan page, you need the page-name. Go to your fan page on facebook and look at the url. It will have this form:

https://www.facebook.com/{fan-page-name}

Once you have that, make a GET request to this url:

https://graph.facebook.com/{fan-page-name}?access_token={access-token}

It will return a bunch of JSON. You're looking for the first "id" element. This is your page-id.

See my answer here.


Just look in the source code of the fb page and search for page_id. Voila!


The answers given before this one (Oct 27, 2015) no longer work.

What works right now is to go to the page or user's Facebook page, and grep the source for fb://page/\d+ or fb://profile/\d+.

Example:

https://www.facebook.com/idorecall/

contains

fb://page/1605841049661522

https://www.facebook.com/dandasco

contains

fb://profile/100002764094643

Try this on the command line:

curl -skA "Mozilla/5.0" https://www.facebook.com/idorecall/ | grep -oE "fb://[^\"]+"


On the page, Press for code source: "Ctrl+U" and search "page_id", on the second or third search, you will find a 16 digit page id.

Now open copy the link: facebook.com/<your-page-id> to verify your finding.


Only solution what worked for me.

Paste desired facebook URL in input

How to get page id of a facebook page

field and it will print Page ID.

How to get page id of a facebook page

https://www.duplichecker.com/find-facebook-id.php

hope this will help.


Just use https://graph.facebook.com/your_username and after you can see all the detain and your ID


Just Go To https://developers.facebook.com/tools/explorer Type in the name of your page in the box and click submit and you will get your page id


Try This :

 $url="http://graph.facebook.com/cocacola";
    $content=file_get_contents($url);
    $x=json_decode($content);
    echo $x->id;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号