Facebook API - Extract URL from facebook fan page cover photo

Asked

Viewed 43 times

1

Good afternoon.

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

I’m unable to assemble the get to bring me the desired information.

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

I need help with the request. Following 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);

1 answer

-1

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.