Logic Machine Forum
HTML Command Send and Receive - 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: HTML Command Send and Receive (/showthread.php?tid=3231)



HTML Command Send and Receive - savaskorkmaz - 17.03.2021

Hi,
We are communicating with an automation system via HTML command.
We are successful with this script for sending command for ( http://192.168.10.10/SetDyNet.cgi?a=3&p=1  )

http = require('socket.http')
url = require('socket.url')
http.TIMEOUT = 5

value = event.getvalue()

if value = 100 then
req = 'http://192.168.10.10/SetDyNet.cgi?a=3&p=1'
http.request(req)
end


But we need also read the status . When we send this command for reading status ( http://192.168.10.10/GetDyNet.cgi?a=3&l ) , we get answer from browser ı=23 .

How we can read via script ?

Regards


RE: HTML Command Send and Receive - admin - 17.03.2021

Try this:
Code:
http = require('socket.http')
http.TIMEOUT = 5
url = 'http://192.168.10.10/GetDyNet.cgi?a=3&l'
response = http.request(url)
log(response)