简体   繁体   English

如何通过Lua中的statuss / update_with_media将图像发布到Twitter

[英]How to POST an image to Twitter by statuses/update_with_media in Lua

I have problems building the header and/or body of the http-POST for a Twitter oAuth update_with_media call in Lua. 我在构建Lua中的Twitter oAuth update_with_media调用的http-POST的标头和/或正文时遇到问题。

  • I'm using multipart/form-data as Content-Type 我正在使用multipart/form-data作为Content-Type
  • All oauth_* parameters are included in the body, including an oauth_signature . 主体中包括所有oauth_*参数,包括oauth_signature
  • POSTing to url https://upload.twitter.com/1/statuses/update_with_media.json 张贴到网址https://upload.twitter.com/1/statuses/update_with_media.json

The problem is I have no idea how to successfully add the image data (media[]) to the body, in addition to 'status' and the other oauth parameters. 问题是,除了“状态”和其他oauth参数之外,我不知道如何将图像数据(media [])成功添加到主体。

Also, how do I calculate the Content-Length ? 另外,如何计算Content-Length

As of yet, I'm constantly getting a 500 Internal Server Error back form Twitter. 到目前为止,我一直在从Twitter获得500内部服务器错误。

Can anyone provide me with a code snippet to add image data (jpg) to a POST? 谁能给我提供代码段,以将图像数据(jpg)添加到POST? I'm using the Corona SDK btw, if that makes any difference. 我正在使用Corona SDK btw,如果有什么不同的话。

If any help, please refer to this issue: Twitter API `status/update_with_media` return `404 Not Found` 如果有帮助,请参考此问题: Twitter API`status / update_with_media`返回`404 Not Found`

If your still get the 500 error, please refer to this one: https://dev.twitter.com/discussions/1525 如果您仍然遇到500错误,请参考以下内容: https : //dev.twitter.com/discussions/1525

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM