How can I use the "manage_pages" permission from the SDK on Facebook?

I am creating an application that appears as a tab on a fan page. The fan page admin gives me permission manage_pages, and then the tab of my application is added to his fans page.

The problem is that I did not find example code on how to use this permission with the PHP SDK. I looked at the base_facebook.phpSDK file and I assume that I should use the function getApiUrl, but I'm not sure and probably do not know how to use this function.

+3
source share
3 answers

, manage_pages, , , , , . , , manage_pages.

function get_page_access_token($page_id, $access_token, $user_id) {
    $data = file_get_contents('https://graph.beta.facebook.com/'.$user_id.'/accounts?access_token='.$access_token);
    $pages = json_decode($data,true);
    foreach($pages['data'] as $page) {
      if($page['id'] == $page_id) {
        return $page['access_token']; 
      }   
   }
}
+5

. $page ['name']

function get_page_access_token($page_id, $access_token, $user_id) {
    $data = curl_get_contents('https://graph.beta.facebook.com/'.$user_id.'/accounts?access_token='.$access_token);
    $pages = json_decode($data,true);
    foreach ($pages['data'] as $page) {
        if ($page['name'] == $page_id) {
            return $page['access_token']; 
        }   
    }
}
+1

I read the answers, but the page_id is not displayed in the answer, how can I get it?

0
source

All Articles