views:

507

answers:

2

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. Once that's done; I want to publish something to the wall of that facebook page.

I found methods describing how to publish to a page in the facebook documentation; but those methods require a pageId variable. I'm not sure how to get that variable since my app uses facebook connect and is not installed "in" the facebook page.

I know this is possible since Seesmic Desktop (formerly Twhirl) has similar functionality.

Does anyone know how to do this?

A: 

I don't know if you've solved this problem but I was looking into doing something similar with 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. 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.)

Gazillion
A: 

As of 3/10/10, there is no method to quickly discover what pages a user is an admin for. However, you can use a single FQL call, see below.

SELECT page_id FROM page_admin WHERE uid = *UID*

in PHP, this looks like:

$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

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

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

)
sprshrp