i wrote a small programm which notifys me on my android, when a button is pushed
pin = 4
gpio.mode(pin,gpio.INPUT)
function buttonpressed()
if gpio.read(pin)== 0 then
conn=net.createConnection(net.TCP, false)
conn:on("receive", function(conn, pl) print(pl) end)
conn:connect(80,"50.116.34.97")
conn:send("GET /publicapi/notify?apikey=MYAPIKEY&application=ESP8266&event=START&description=Der%20Schalter%20wurde%20gedrückt\r\n"
.."Connection: keep-alive\r\nAccept: */*\r\n\r\n")
tmr.delay(500000)
end
end
tmr.alarm(0, 100, 1, function() buttonpressed() end )
It works fine and when i push the button, i get this payload ( pl ) printed on the serial terminal :
<?xml version="1.0" encoding="UTF-8"?><nma><success code="200" remaining="989" resettimer="45"/></nma>
But how can i save the payload to a string / char and search for words like " success code" or "resettimer="?
Or is there a way to save the payload and let a command search a character at a specfied place?
Sorry for my English, I'm a young student from Germany
Joshua