Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用update_with_media-Lua将图像上传到twitter_Lua_Twitter_Twitter Oauth - Fatal编程技术网

使用update_with_media-Lua将图像上传到twitter

使用update_with_media-Lua将图像上传到twitter,lua,twitter,twitter-oauth,Lua,Twitter,Twitter Oauth,我正在尝试使用update_with_media.json向twitter发布一张图片 以下是使用status/update.json更新tweet的工作代码 local url = "http://api.twitter.com/1/statuses/update.json" local consumer_key = "" local consumer_secret = "" local token = "" local token_secret = "" local post_data

我正在尝试使用update_with_media.json向twitter发布一张图片

以下是使用status/update.json更新tweet的工作代码

local url = "http://api.twitter.com/1/statuses/update.json"
local consumer_key = ""
local consumer_secret = ""
local token = ""
local token_secret = ""


local post_data = 
    {
    oauth_consumer_key = consumer_key,
    oauth_nonce        = get_nonce(),
    oauth_signature_method = "HMAC-SHA1",
    oauth_token        = token,
    oauth_timestamp    = get_timestamp(),
    oauth_version      = '1.0',
    oauth_token_secret = token_secret

    }

post_data["status"] = "Hello Twitter!"      
post_data = oAuthSign(url, "POST", post_data, consumer_secret)


r,c,h = http.request
   {
   url = url,
   method = "POST",
   headers = 
         {
         ["Content-Type"] = "application/x-www-form-urlencoded", 
         ["Content-Length"] = string.len(rawdata)
         },
   source = ltn12.source.string(post_data),
   sink = ltn12.sink.table(response)
   }
现在我如何修改上面的代码来上传图像? url将是“http://api.twitter.com/1/statuses/update_with_media.json"及 标题[“内容类型”]将是“多部分/表单数据”


但是在哪里以及如何指定要上载的图像

好吧,我很久以前就开始工作了。。 这篇文章提供了一个很好的处理twitter的库


诚然,代码是为一个名为Corona SDK的游戏引擎编写的。但是,对于其他人来说,通过去除电晕特有的元素来使用它应该不会太难。

好的,我很久以前就开始使用了。。 这篇文章提供了一个很好的处理twitter的库

诚然,代码是为一个名为Corona SDK的游戏引擎编写的。但它不应该太难为其他人使用去除电晕特定的元素从它