this is my logs when i post the data to php server.
if ngx.var.request_method == "POST" then
-- ngx.exit(ngx.HTTP_FORBIDDEN);
ngx.req.read_body();
-- local uargs = ngx.req.get_uri_args();
-- local pargs = ngx.req.get_post_args();
local phead = ngx.req.get_headers();
local pcontent = ngx.req.get_body_data();
if pcontent then
local tmprandom = math.random(1,2);
local hc = http:new()
local ok, code, headers, status, body = hc:request {
url = "" cloudfetch[tmprandom], tmpuri) .. "?" .. ngx.var.args,
-- proxy = "http://" .. ngx.decode_base64(ngx.var.proxy),
timeout = 3000,
method = "POST", -- POST or GET
-- add post content-type and cookie
-- headers = phead,
headers = { ["Host"] = cloudfetch[tmprandom] .. ".
duapp.com", ["Content-Length"] = string.len(pcontent), ["Content-Type"] = "application/x-www-form-
urlencoded"}, -- body = ltn12.source.string(form_data),
body = pcontent,
}
if code == 200 and body ~= nil then
ngx.print(body);
else
local wname = "/data/logs/rholog.txt"
local wfile = io.open(wname, "w+");
wfile:write(os.date());
wfile:write("\r\n---------------------\r\n");
wfile:write(pcontent);
wfile:write("\r\n---------------------\r\n");
wfile:write(code);
wfile:write("\r\n---------------------\r\n");
wfile:write(ngx.var.remote_addr);
wfile:write("\r\n---------------------\r\n");
wfile:write(string.format(baseurl, cloudfetch[tmprandom], tmpuri) .. "?" .. ngx.var.args);
wfile:write("\r\n---------------------\r\n");
io.close(wfile);
ngx.print(error000(code, status))
end
else
ngx.print(0)
end
end