您好,我试图获取我管理的所有页面的个人资料图片。 我试过这样的事情:
//我的循环:
$request[] = array(
'method' => 'POST',
'relative_url' => '/'.$account->id.'/?fields=picture.type(large)&access_token='.$account->access_token.''
);
然后:
$batchResponse = $this->facebook->api('?batch='.json_encode($request),'POST',array('access_token' => $this->facebook->getAccessToken()));
没有成功:/
我还尝试在body标签中设置页面的access_token:
$request[] = array(
'method' => 'POST',
'relative_url' => '/'.$account->id.'/?fields=picture.type(large)'
'body' => '&access_token='.$account->access_token.''
;
答案 0 :(得分:1)
你的PHP script should have you login。如果登录成功,SDK将为您管理access_token。
然后发出这一个请求:
$result = $this->facebook->api('/me/accounts?fields=name,picture.type(large)', 'GET');
如果您不想进行身份验证,则可以传递一组ID:
$page_ids = array( _PAGE_ID_1, _PAGE_ID_2, ...);
$result = $this->facebook->api('/?ids=' . implode(',',$page_ids) . '&fields=name,picture.type(large)', 'GET');
对于这些查询,您获取数据,因此您应该使用GET
请求。在Facebook API中,POST
请求仅在您向Facebook发送数据时使用。