Facebook Graph API + Facebook Pages

后端 未结 9 1500
温柔的废话
温柔的废话 2021-02-06 09:17

Using Facebook\'s Graph API, given a username xyz (assuming they\'ve authenticated my site), how do I get a list of all of the facebook pages that the user administers?

9条回答
  •  鱼传尺愫
    2021-02-06 10:00

    Here's what I use. It works perfect

    $pages = $facebook->api(array('method' => 'fql.query','query' => 'SELECT page_id FROM page_admin WHERE uid = '.$uid.''));
    
    foreach($pages as $k=>$v) {
        echo 'page id#:'.$v['page_id'].'
    '; }

    This is of course after you have the session created for the fb user! The $uid would be the profile id# of the specific facebook user your returning of a list of managed pages for.

提交回复
热议问题