How to response http post with lua - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: How to response http post with lua (/showthread.php?tid=3470) |
How to response http post with lua - pouralise - 14.07.2021 I have the code below to receive an http post from external server via port 8083. After that, how can I response so the server would get the http status code 200? Code: local socket = require("socket") RE: How to response http post with lua - admin - 14.07.2021 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: <? RE: How to response http post with lua - pouralise - 14.07.2021 I save the code as post.lp Then I upload that file to folder user in LM (can't upload to folder public since it show error: Could not creat file like in screenshot. Now what would I should input here? and the local port should be 21 FTP or 80 HTTP? RE: How to response http post with lua - admin - 14.07.2021 Use port 80 for HTTP and port 443 for HTTPS. RE: How to response http post with lua - pouralise - 14.07.2021 Thank you very much. It worked |