如何通过Facebook API发布多张照片? [英] How do I can post a multiple photos via Facebook API

查看:333
本文介绍了如何通过Facebook API发布多张照片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我发布一张照片到墙上:

Now I posting a single photo to wall like this:

$response = $facebook->api("/$group_id/photos", "POST", array(
    'access_token=' => $access_token,
    'message' => 'This is a test message',
    'url' => 'http://d24w6bsrhbeh9d.cloudfront.net/photo/agydwb6_460s.jpg',
   )
);

它可以正常工作,但我可以以某种方式发布多张照片,如下所示:

It works fine, but can I somehow post a multiple photos, something like this:

提前感谢

推荐答案

您可以按照以下提到批量请求: https://stackoverflow.com/a/11025457/1343690

You can make batch requests as mentioned here: https://stackoverflow.com/a/11025457/1343690

但它的简单循环浏览图像并直接发布。

But its simple to loop through your images and publish them directly.

foreach($photos as $photo)
{
       //publish photo
}


编辑:

(关于墙上的照片分组)

(regarding grouping of photos on wall)

如果某些照片被上传到相同的相册

This grouping is done by facebook automatically if some photos are uploaded into the same album.

目前,您无法在群组通过Graph API - 它不支持(截至目前),请参阅此错误

但是您可以手动创建相册,然后获取 album_id by-

\GET / {group-id} / albums ,然后使用 album_id 而不是 group_id -

But you can do this - create an album manually, then get the album_id by-
\GET /{group-id}/albums, then use the the code with album_id instead of group_id-

foreach($photos as $photo){
   $facebook->api("/{album-id}/photos", "POST", array(
      'access_token=' => $access_token,
      'name' => 'This is a test message',
      'url' => $photo
      )
   );
}






我已经测试了,请看结果 -


I've tested it, see the result-

这篇关于如何通过Facebook API发布多张照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆