简体   繁体   English

Facebook-获取具有/不具有访问令牌的页面ID

[英]Facebook - get page id with/without access token

Their is a way to get a facebook page id via get request? 他们是通过获取请求获取Facebook页面ID的方法吗? Or i need to send also a access token ? 或者我还需要发送访问令牌?

For the second option. 对于第二个选项。 I have a facebook application. 我有一个Facebook应用程序。 How i can get the facebook page id? 我如何获取Facebook页面ID?

I use this code ( Extracting page id from a facebook page url ): 我使用以下代码( 从Facebook页面url中提取页面ID ):

$fbUrl = "https://www.facebook.com/Lo-stile-di-Anna-
1521824524722026";
$graphUrl = "https://graph.facebook.com/?id=".$fbUrl."&access_token=xxxxx&fields=id";
$output = file_get_contents($graphUrl);
$output = json_decode($output, TRUE);
echo $output["id"]; // returns 1521824524722026

As you can see i need the access_token parameter. 如您所见,我需要access_token参数。 How can i obtain it automatically (via script call) or how can it stay permanent? 我如何自动(通过脚本调用)获取它,或者如何使其永久保存?

Thank you! 谢谢!

You can use an App Access Token, it is just a combination of App ID and App Secret with a pipe sign: App-ID|App-Secret 您可以使用App Access令牌,它只是App ID和App Secret的组合,带有管道符号: App-ID|App-Secret

You get the ID of a page with this API call: graph.facebook.com/bladauhu?access_token?xxx 您可以使用以下API调用获取页面的ID: graph.facebook.com/bladauhu?access_token?xxx

More information about Tokens: 有关令牌的更多信息:

I've used the facebook SDK in past but with PHP. 我过去使用过Facebook SDK,但使用过PHP。

Every request need that you have an access token setted and a facebook app id configured. 每个请求都需要您设置访问令牌并配置一个Facebook应用ID。 So, i think that it's not possible to access the resource you need without a token. 因此,我认为没有令牌就无法访问所需的资源。

Read the facebook API documentation for more info about Facebook Developers 阅读facebook API文档以获取有关Facebook Developers的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM