在Facebook上多张照片上传 [英] Multiple Photos upload on Facebook

查看:175
本文介绍了在Facebook上多张照片上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Facebook上一起上传多张照片?
我已经上传了一张照片,一次使用GraphAPI ....但不是多个...
请建议..
谢谢...

解决方案

您需要将一个批量请求放在Graph API中。这是在这里记录的: https://developers.facebook.com/docs/reference/api / batch / (查看上传二进制数据一节)。基本上这是一个cURL调用,你可以在其中编码一个包含所有批处理请求的数组(batch = [json array of call])。对于一些好的共鸣,Facebook将您的阵列限制为20个请求。它很好地翻译成PHP cURL方法,如果您的服务器上启用了cURL ...

  curl 
-F'access_token = ...'\
-F'batch = [{method:POST,\
relative_url:me / photos,\
body:message =我的猫照片\
attached_files:file1\
},
{method:POST,\
relative_url:我/照片,\
body:message =我的狗照片\
attached_files:file2\
} ,
]'
-F'file1=@cat.gif'\
-F'file2=@dog.jpg'\
https://graph.facebook .com

更新:替换为和与 p>

Is there any way to upload multiple photos together on facebook... I have uploaded a single photo at a time using GraphAPI....but not multiple... Please suggest... Thanks...

解决方案

You need to place a "batched" request to the Graph API. This is documented here: https://developers.facebook.com/docs/reference/api/batch/ (check out the paragraph "Uploading binary data"). Basically it's a cURL call where you json encode an array containing all the "batched" requests ("batch=[json array of calls]"). For some good reson Facebook limits your array to 20 requests. It translates pretty nicely to the PHP cURL methods, if you've got cURL enabled on your server...

curl 
 –F  'access_token=…' \
 -F  'batch=[{"method":"POST", \
              "relative_url":"me/photos", \
              "body":"message=My cat photo" \
              "attached_files":"file1" \
             },
             {"method":"POST", \
              "relative_url":"me/photos", \
              "body":"message=My dog photo" \
              "attached_files":"file2" \
             },
            ]’
 -F  'file1=@cat.gif' \
 -F 'file2=@dog.jpg' \
https://graph.facebook.com

UPDATE: replaced " with " and ‘ with '

这篇关于在Facebook上多张照片上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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