This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Help decoding JSON data from socket.http.request
#7
(02.11.2017, 07:44)admin Wrote: Strange, I've tested it with your access details and it works correctly. Which firmware version are you running?

1Version 2: 20170620

It should be the last I think ?

I'll try again ..

(02.11.2017, 07:48)admin Wrote: Can you also try running request like this?

Code:
sock = require('socket').tcp()
sock:settimeout(5)

res, err = sock:connect('192.168.1.xx', 80)
if res then
 sock:send('GET /inst.json HTTP/1.1\r\n\r\n')
 res = sock:receive('*a')
 log(res)

 if res then
   p, e = res:find('\r\n\r\n', 1, true)
   if e then
     data = res:sub(e + 1)
     data = require('json').pdecode(data)
     log(data)
   end
 end
end

Thanks, it works perfectly !
Reply


Messages In This Thread
RE: Help decoding JSON data from socket.http.request - by mooselight - 02.11.2017, 07:48

Forum Jump: