14.07.2021, 04:39
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:
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)