2013-04-08 25 views
0

嗨,我試圖獲取我管理的頁面的所有配置文件圖像。 我想是這樣的:FB批量請求:獲取受管理頁面的Profil圖像

//我的循環:

$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())); 

沒有成功:/

我也試着設置正文標籤頁面的access_token:

$request[] = array(
     'method' => 'POST', 
     'relative_url' => '/'.$account->id.'/?fields=picture.type(large)' 
     'body' => '&access_token='.$account->access_token.'' 
    ; 

回答

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發送數據時使用。