Hi there i tried to get all the Profile-Images of the Pages i managed. I tried something like this:
// my loop:
$request[] = array(
'method' => 'POST',
'relative_url' => '/'.$account->id.'/?fields=picture.type(large)&access_token='.$account->access_token.''
);
and then:
$batchResponse = $this->facebook->api('?batch='.json_encode($request),'POST',array('access_token' => $this->facebook->getAccessToken()));
without success :/
i also tried to set the access_token of the page in the body tag:
$request[] = array(
'method' => 'POST',
'relative_url' => '/'.$account->id.'/?fields=picture.type(large)'
'body' => '&access_token='.$account->access_token.''
;
Your PHP script should have you login. If the login was successful, the SDK will manage the access_token for you.
Then issue this one request:
$result = $this->facebook->api('/me/accounts?fields=name,picture.type(large)', 'GET');
If you don't want to authenticate, instead you can pass an array of ids:
$page_ids = array( _PAGE_ID_1, _PAGE_ID_2, ...);
$result = $this->facebook->api('/?ids=' . implode(',',$page_ids) . '&fields=name,picture.type(large)', 'GET');
For these queries, you are getting data, so you should be using a GET
request. Within the Facebook API, POST
requests are only used when you are sending data to Facebook.