Issue
I'm trying to post json in Lua using cURL. I can't find any example online.
Something like this:
c = curl.easy{
url = "http://posttestserver.com/post.php",
-- url = "http://httpbin.org/post",
post = true,
httppost = curl.form{
data = "{}",
type = "application/json",
},
}
t = {}
c:perform{
writefunction = function(s)
t[#t+1] = s
end
}
c:close()
Solution
Try this one.
local cURL = require "cURL"
c = cURL.easy{
url = "http://posttestserver.com/post.php",
post = true,
httpheader = {
"Content-Type: application/json";
};
postfields = "{}";
}
c:perform()
Answered By - moteus Answer Checked By - Cary Denson (WPSolving Admin)