使用 php-sdk 获取 facebook 相册 URL
使用 facebook php-sdk,用户可以将照片从我们的网站上传到 facebook。我可以创建相册并上传照片。但无法获取新创建的相册的 URL :(
这就是我所做的...
// create album
$albumDetails = array(
'name' => 'Fun images'
);
$album = $facebook->api('/me/albums', 'post', $albumDetails);
$albumID = $album['id'];
// upload photos
foreach ($images as $image) {
$file = FACEBOOK_IMAGES_DIR . $image->image_id . '.jpg';
$photoDetails = array(
'message'=> 'by choreboy'
);
$photoDetails['image'] = '@' . realpath($file);
$photoData = $facebook->api('/'.$albumID.'/photos', 'post', $photoDetails);
}
// Graph API says I can get link to the album:
// http://developers.facebook.com/docs/reference/api/album
// I thought I could get to the link data this way. But returns an empty array
$data=$facebook->api("/{$albumID}/photos?access_token={$session['access_token']}");
var_dump($data);
Using the facebook php-sdk, users can upload photos to facebook from our site. I can create the album and upload the photos. But can't get the URL to the newly created Album :(
Here's what I do ...
// create album
$albumDetails = array(
'name' => 'Fun images'
);
$album = $facebook->api('/me/albums', 'post', $albumDetails);
$albumID = $album['id'];
// upload photos
foreach ($images as $image) {
$file = FACEBOOK_IMAGES_DIR . $image->image_id . '.jpg';
$photoDetails = array(
'message'=> 'by choreboy'
);
$photoDetails['image'] = '@' . realpath($file);
$photoData = $facebook->api('/'.$albumID.'/photos', 'post', $photoDetails);
}
// Graph API says I can get link to the album:
// http://developers.facebook.com/docs/reference/api/album
// I thought I could get to the link data this way. But returns an empty array
$data=$facebook->api("/{$albumID}/photos?access_token={$session['access_token']}");
var_dump($data);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您缺少此代码中的第一行。
Maybe you are missing the first line in this code.
此 URL 重定向到您的相册:
This URL redirects to your album: