Get page information without being logged in to facebook, only by the token

0

I'm creating a posting system for facebook and it's all right, except for one thing. When I uncheck facebook for the system I'm doing, some functions do not work, however much I pass the user or page access token.

I am using a Facebook SDK library for Codeigniter :

//METODO, POINT, PARAMS, TOKEN
$query = $this->request('get', '/'.$idPage, null, $row->token);

What it returns me is:

  

You must provide an access token.

I need to run because the system will have CRON and need to make the posts on the page without the user being logged in

The permissions I'm getting are:

  • manage_pages
  • publish_pages
  • pages_show_list
  • public_profile
  • publish_actions
  • email
  • user_managed_groups
  • user_posts
  • user_likes
asked by anonymous 18.03.2017 / 19:23

1 answer

0

SOLUTION FOUND!

The request() function makes various types of requests to facebook. When I use POST it is necessary to pass the parameters, thus:

$query = $this->request('post', '/'.$idPage, $parametros, $row->token);

As I'm trying to make a GET , then in place of $parametros I need to send the token directly:

$query = $this->request('get', '/'.$idPage, $row->token);

That way it worked.

  

Library Link to CodeIgniter 3.x:    link

    
19.03.2017 / 04:08