简体   繁体   English

如何获取Facebook用户所管理页面的pageId? 使用Facebook连接

[英]How to get pageId for pages the facebook user is an admin of? Using facebook connect

The user authenticates using Facebook Connect and once that's done I want to retrieve the pageIds for the pages he is a fan of. 该用户使用Facebook Connect进行身份验证,完成后,我想检索他喜欢的页面的pageIds。 Once that's done; 完成后; I want to publish something to the wall of that facebook page. 我想在该Facebook页面的墙上发布一些内容。

I found methods describing how to publish to a page in the facebook documentation; 我在facebook文档中找到了描述如何发布到页面的方法。 but those methods require a pageId variable. 但是这些方法需要pageId变量。 I'm not sure how to get that variable since my app uses facebook connect and is not installed "in" the facebook page. 我不确定如何获取该变量,因为我的应用使用了Facebook Connect,并且未“安装”在Facebook页面中。

I know this is possible since Seesmic Desktop (formerly Twhirl) has similar functionality. 我知道这是可能的,因为Seesmic Desktop(以前称为Twhirl)具有类似的功能。

Does anyone know how to do this? 有谁知道如何做到这一点?

As of 3/10/10, there is no method to quickly discover what pages a user is an admin for. 截至3/10/10,还没有方法可以快速发现用户是管理员的页面。 However, you can use a single FQL call, see below. 但是,您可以使用单个FQL调用,请参见下文。

SELECT page_id FROM page_admin WHERE uid = *UID*

in PHP, this looks like: 在PHP中,这看起来像:

$this->fb = new Facebook('api_key', 'api_secret');    
$fb_uid = $this->fb->get_loggedin_user();
$query = "SELECT page_id FROM page_admin WHERE uid = " . $fb_uid;
try{
  $array = $this->fb->api_client->fql_query($query);
  return $array;
} catch (Exception $e){
  return false;
}

this will return a PHP array like this 这将返回这样的PHP数组

Array
(
    [0] => Array
        (
            [page_id] => 12341234
        )

    [1] => Array
        (
            [page_id] => 43214321
        )

)

I don't know if you've solved this problem but I was looking into doing something similar with php. 我不知道您是否已经解决了这个问题,但我正在考虑使用php做类似的事情。 I've been reading the facebook api wiki and trying stuff out with their test console and I found that if you use the pages.getInfo and only ask for the page_id it'll give you a list of pages that the user is a fan of. 我一直在阅读facebook api Wiki,并尝试使用其测试控制台进行试验 ,发现如果您使用pages.getInfo并仅询问page_id,它将为您提供用户喜欢的页面列表。 After that it's just a matter of checking if their the admin to that page and figure if they want to post to it. 之后,只需检查他们的管理员是否对该页面进行管理,并确定他们是否要发布到该页面。

I'd give you some code but we're not working in the same language and I haven't implemented anything yet. 我会给您一些代码,但是我们使用的不是同一语言,并且我还没有实现任何东西。 (I figure this might have been resolved by you since the question is pretty old but I figured that I'd answer seeing how you were one of the top google results, in case someone else stumbled upon it.) (由于问题已经很久了,我认为这可能已经由您解决了,但是我认为我会回答看您是Google最佳搜索结果之一的情况,以防其他人偶然发现它。)

暂无
暂无

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

相关问题 Facebook Graph API/SDK .NET - 获取 Facebook 用户的 PageID - Facebook Graph API/SDK .NET - Get PageID of a Facebook user 使用facebook c#sdk V. 6.x如何获取用户管理的所有页面的列表? - using the facebook c# sdk V. 6.x how can i acquire a list of all pages the user is admin on? 如何使用Facebook应用程序获取Facebook用户令牌 - How to get the facebook user token with a facebook application 如何连接到Facebook,并使用C#SDK调试Facebook应用程序 - How to connect to facebook, and debug facebook application using C# SDK 如何使用httpwebrequest登录到Facebook并获取用户访问令牌? - How to login to facebook and get user access token using httpwebrequest? 如何使用Facebook C#SDK获取用户朋友列表? - How To Get User Friends List Using Facebook C# SDK? 如何获取Facebook用户注册我的网站的个人资料照片与Facebook注册申请(不使用mvc) - How to get the profile photo of facebook user who is registered my site with facebook registration application(not using mvc) 如何从 facebook 获取用户的朋友,并使用 C# Facebook ZF203675AZ5E5043F8AB66 向他们发送所有消息 - How to get user's friends, from facebook, and send them all messages, by using C# Facebook SDK? C#和iOS连接到Facebook并获取用户的个人资料信息 - c# and ios connect to facebook and get the profile information of the user 使用Facebook Connect无人值守登录Facebook - Unattended login to Facebook using Facebook connect
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM