通过网址上传Facebook的Graph API的托管图像? [英] Upload a hosted image with Facebook's Graph API by url?

查看:94
本文介绍了通过网址上传Facebook的Graph API的托管图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我使用Facebook Graph API上传一张照片。使用curl,它就像这样:

So, I'm using the Facebook Graph API to upload a photo. Using curl, it goes something like this:

curl -F 'access_token={some access token}'
-F 'source=@/some/file/path/foo.png'
-F 'message=This is a test of programatic image uploading' 
https://graph.facebook.com/me/photos

现在,如果我将机器上的文件提交给我, 。问题是我正在处理的系统将图像作为URL(比如说http://example.com/foo.png)。我宁愿不将image.com的图片下载到我的服务器上,只是为了将其上传到Facebook,因为我不需要保存它。有什么办法可以将URL传递给Facebook,还是不可能的?

Now, this works fine if I have the file on the machine I'm making the request from. The issue is that the system I'm working on gets the image as a url (say, "http://example.com/foo.png"). I'd rather not download the image from example.com to my server just to upload it to facebook, since I have no need to keep it other than that. Is there any way I can just pass the url to facebook, or is this impossible?

( - F'source = @ http://example.com/foo。 png'不起作用)

(-F 'source=@http://example.com/foo.png' does not work)

推荐答案

在过去,我们只是将文件本地下载到服务器,然后处理上传并取消链接这样,我们也可以确保资源可用(服务器/连接剥离)首先上传。我不相信你可以发起上传,媒体来自第三方(可能是错误的)。

In the past, we've simply downloaded the file locally to the server, then handled the upload and unlinked it. This way we're also able to be sure that the asset was available (servers/connections flaking out) to be uploaded in the first place. I don't believe you can initiate an upload and the media to come from a third-party (may be wrong though).

这篇关于通过网址上传Facebook的Graph API的托管图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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