使用 Facebook Javascript SDK 获取“管理页面”弹出窗口?

发布于 2024-12-01 14:06:03 字数 341 浏览 5 评论 0原文

我找到的 Facebook SDK 的大多数示例和教程都是用于发布到用户帐户的。

作为使用过 Facebook PHP SDK 但未使用 Javascript SDK 的人,我找不到以下示例或教程:

  1. 用户单击 FB 连接按钮
  2. 弹出窗口显示可管理的粉丝页面
  3. 用户选择他们喜欢我的网站的页面管理
  4. 我的网站获取所选页面的 ID

在我的网站中,我不想将信息发布到管理员的粉丝页面,而只是获取他们想要在我的网站上使用的页面的 ID。感谢 PHP SDK,我已经有了一种从管理员的粉丝页面中提取我需要的所有信息的方法。

有这样的指南吗?

Most of the examples and tutorials I have found for the Facebook SDK are for publishing to user accounts.

As someone who has used the Facebook PHP SDK but not the Javascript SDK, I can't find an example or tutorial for the following:

  1. User clicks FB connect button
  2. Popup window shows manageable Fan Pages
  3. User chooses a Page which they'd like my website to manage
  4. My website gets the ID of the chosen Page

With my website I'm not looking to post information to the admin's Fan Page, but rather just get the ID of the Page they want to use with my site. Thanks to the PHP SDK, I already have a method of pulling all the information from the admin's Fan Page that I need.

Is there such a guide?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一梦浮鱼 2024-12-08 14:06:03

您可以使用该图表获取“/me/accounts”,它将列出用户管理的所有应用程序/页面。您需要为步骤 2 和 3 创建自己的选择弹出窗口,使用响应对象中的数据作为在步骤 4 中提交回站点的值。

尝试如下操作:

FB.login(function (response){
FB.api('/me/accounts',function(apiresponse){
var data=apiresponse['data'];
var ids = new Array();
for(var i=0; i<data.length; i++){
ids[i]=data[i].id;
}
console.log(ids);
});

},{scope:'manage_pages'});

You can use the graph to get '/me/accounts' which will list all of the apps/pages that the user administrates. You will need to create your own selection pop up for step 2 and 3, using the data from the response object as the values to submit back to your site in step 4.

Try something like this:

FB.login(function (response){
FB.api('/me/accounts',function(apiresponse){
var data=apiresponse['data'];
var ids = new Array();
for(var i=0; i<data.length; i++){
ids[i]=data[i].id;
}
console.log(ids);
});

},{scope:'manage_pages'});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文