如何获取Facebook页面的页面ID [英] How to get page id of a facebook page

查看:120
本文介绍了如何获取Facebook页面的页面ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在图形API中获取给定URL的Facebook页面的页面ID.例如,这是URL http://www.facebook.com/platform ,我想获取页面此Facebook页面的ID.我尝试了所有可能的解决方案,但失败了.请任何人帮我....请...谢谢!

I need to fetch page id of a facebook 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!

推荐答案

在2015年10月27日之前给出的答案不再起作用,在此之后给出的其他答案不是动态的,但需要进行站点抓取.该答案提供了必要的 URL .

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)通过选择一个现有应用或在此URL上创建一个新应用来获取您的应用ID和应用秘密:

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)通过对此URL进行GET请求来获取访问令牌:

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)要获取粉丝页面的页面ID,您需要页面名称.转到Facebook上的粉丝页面,然后查看网址.它将具有以下形式:

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}

拥有该地址后,请对该URL进行GET请求:

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

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

它将返回一堆JSON.您正在寻找第一个"id"元素.这是您的页面ID.

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

请参阅我的回答 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆