开发者

Upload a hosted image with Facebook's Graph API by url?

开发者 https://www.devze.com 2023-02-19 19:17 出处:网络
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}\'

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 prog开发者_Go百科ramatic image uploading' 
https://graph.facebook.com/me/photos

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' 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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号