This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How to response http post with lua
#2
You can do this with the built-in web server and .lp file. Save the code as post.lp file and upload to LM via FTP using apps username (you might need to enable FTP in System config). If your HTTP client supports basic auth then you can upload post.lp into user directory on the FTP. If it does not then you can use public directory. The HTTP path will be either http://LM_IP/user/post.lp or http://LM_IP/public/post.lp

This example logs data that has been sent via POST in JSON format:
Code:
<?

require('apps')
data = ngx.req.get_body_data()
data = json.pdecode(data)

log(data)
Reply


Messages In This Thread
RE: How to response http post with lua - by admin - 14.07.2021, 04:39

Forum Jump: