這裏的PHP腳本我已經寫信給搶照片,並將其上傳到Dropbox的(使用Dropbox的PHP SDK):
它實際上是更簡單的話,我最初的想象。不需要用戶標識。
$app_id = 'xxxxxx';
$app_secret = 'xxxxx';
$photoId = 'xxxxx';
$access_token = 'xxxxx';
try {
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
));
} catch (Exception $e) {
}
try {
$attachment = array('access_token' => $access_token);
$photo = $facebook->api($photoId, 'GET', $attachment);
} catch (Exception $e) {
}
$dropbox = new DropboxUploader('xxxxxxx', 'xxxxxxxx');
$tmpfname = '/tmp/' . $photoId . '.png';
$fp = fopen($tmpfname,'x');
fwrite($fp, file_get_contents($photo['source']));
fclose($fp);
$dropbox->upload($tmpfname, 'photos/');
unlink($tmpfname);
exit;
欲瞭解更多信息:https://developers.facebook.com/blog/post/498/ –
謝謝,你有抓住所有的照片從album_id任何代碼示例(或photo_id)並保存到本地存儲? – aporat
使用'user_photos'權限,您可以查詢用戶相冊的列表。如果您的應用的相冊不存在,則可以使用圖形API創建相冊,然後通過進行相應的Graph API調用將照片上傳到其中。 –