How to HTTP POST in Lua without using Lua Socket -
i trying send http post command external server lua scripted piece of hardware. in order have create tcpconnection , tcpsend() command. have confirmed tcp connection using wireshark , have seen send http command not know how send post. have tried change post in code no avail.
debugconsole = -20 while true --opening connection remote host debugconsole = tcpconnect("192.168.1.1", 80, 100) print("tcp connect " .. debugconsole) debugconsole = tcpsend("get /api/v1/profiles/active_profiles.json?profile=5&expiry=1&duration=0&auth_token=2e608b72390a866f4bc7bbb6db63a1aa http/1.1 \r\n\r\n") print("tcp send = " .. debugconsole) --printing response remote host print(responsesubstr(0, 500)) debugconsole = tcpclose() print("tcp close = " .. debugconsole) debugconsole = httprequest("http://192.168.1.1/api/v1/profiles/active_profiles.json?profile=5&expiry=1&duration=0&auth_token=2e608b72390a866f4bc7bbb6db63a1aa", 10) print("http request = " .. debugconsole) print(" ") sleep (10000) end
Comments
Post a Comment