local http = require 'socket.http'
local ltn12 = require 'ltn12'
local cjson = require "cjson"
function getNick()
local reqbody = 'name=&sur=&gender=1&nation=11'
local respbody = {}
local body, code, headers, status = http.request{
method = 'POST',
url = 'http://nickname.play-force.ru/generate.php',
source = ltn12.source.string(reqbody),
headers = {
['Content-Type'] = 'application/x-www-form-urlencoded',
['content-length'] = reqbody:len()
},
sink = ltn12.sink.table(respbody)
}
local response = table.concat(respbody)
local parse = cjson.decode(response)
return parse.message
end