Facebook API - Extract URL from Facebook fan page cover photo

1

Good afternoon.

I'm starting to study the facebook API and I'm having a hard time getting the URL of the cover photo of some fan page.

I'm not able to mount the get to bring me the information I want.

As the code below I have already generated the token for API access and is accessing normal.

I need help on request. Next code snippet $ request = $ fb-> request ('GET', '/'.$ page_id.' /)

Someone with more API experience can help me.

include 'vendor/autoload.php';

$page_id = '1634111220214490';
$app_id = ''; //Preenchi este valor
$app_secret = ''; //Preenchi este valor

$fb = new \Facebook\Facebook([
 'app_id' => $app_id
 ,'app_secret' => $app_secret
]);

$expires = time()+(60*60)*2; //Auxilia na geração do token

$fbAt = new \Facebook\Authentication\AccessToken($app_id.'|'.$app_secret, $expires);
$token = (string)$fbAt;

$fb->setDefaultAccessToken($token);

//O erro está nesta linha
$request = $fb->request('GET', '/'.$page_id.'/);

$response = $fb->getClient()->sendRequest($request);

$body = $response->getBody();

$obj = json_decode($body);

var_dump($obj);
    
asked by anonymous 06.08.2018 / 21:50

1 answer

-1

The error is in the right bar I think. Take it .. or add some field name after it .. Type  '/'.$ page_id.' / cover '

    
12.09.2018 / 09:47