Facebook API - 如何使用Facebook API获取页面ID? [英] Facebook API - how to get page ID using Facebook API?

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

问题描述

使用Facebook API,在自定义应用程序中添加到粉丝页面(标签应用)中,如何获取粉丝ID?

With Facebook API, within a custom app added to a fanpage (tab app), how do I get the fanpage ID?

这是我正在尝试的实现:

Here's what I'm trying to achieve:


  • 用户转到全景画布应用程序,他授权自己在那里,并允许应用程序向其中一个添加标签每个Facebook用户访问该粉丝页面的人都喜欢他/他们的管理,看到该标签,该标签显示该粉丝专门的内容(这就是为什么我需要知道粉丝ID)

  • 如果粉丝页面管理员想要改变某些东西,他将转到全幅画布并登录到我的服务(这里是我想要在他的Fanpage中显示的内容)

推荐答案

从解析的签名请求(到标签iFrame)可以获取页面ID - 内容将类似于以下(PHP print_r的输出):

From a parsed signed request (to an tab iFrame) you can get the page id - the contents would be similar to the following (output of PHP print_r):

stdClass Object
(
    [algorithm] => HMAC-SHA256
    [issued_at] => xxxxxxxxxx
    [page] => stdClass Object
        (
            [id] => FAN_PAGE_ID // target page id
            [liked] => 1        // is the user a fan
            [admin] =>          // is the user an admin
        )

    [user] => stdClass Object
        (
            [country] => ie
            [locale] => en_GB
            [age] => stdClass Object
                (
                    [min] => 21
                )

        )

)

有关详细信息,请参阅:
http:// developers.facebook.com/docs/authentication/signed_request/

For more information see: http://developers.facebook.com/docs/authentication/signed_request/

这篇关于Facebook API - 如何使用Facebook API获取页面ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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