Abd*_*eeb 0 php photo facebook-graph-api
如何创建这样的?我网站上的用户可以将图片上传到他们的FB页面.例如:myfbcover.com
我上传了这些文件(https://github.com/facebook/php-sdk).现在接下来做什么?请帮我 !
基本示例:
$facebook = new Facebook(array(
'appId' => 'APP_ID',
'secret' => 'APP_SECRET',
'cookie' => true,
));
$user = $facebook->getUser();
if ($user) {
$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message'=> 'Album desc',
'name'=> 'Album name'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//Get album ID of the album you've just created
$album_uid = $create_album['id'];
//Upload a photo to album of ID...
$photo_details = array(
'message'=> 'Photo message'
);
$file='app.jpg'; //Example image file
$photo_details['image'] = '@' . realpath($file);
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
}
这只是一个例子.你可以在谷歌上找到很多来源.希望它可以帮助您入门