Page 1 of 1

Need help : Lua reading log

Posted: Thursday 30 August 2018 21:42
by zicht
Hi

I am trying to read some status value from the log from json

Code: Select all

curl http://192.168.xxx.xxx:8080/json.htm?type=command&param=getlog&lastlogtime=0&loglevel=268435455
Response i get :

Code: Select all

{ "status" : "ERR" }
 
If i copy the same url to my browser i get perfecty i json respond with the log entries.
What am i doing wrong ?

Re: Need help : Lua reading log

Posted: Friday 31 August 2018 18:09
by waaren
zicht wrote: Thursday 30 August 2018 21:42 I am trying to read some status value from the log from json

Code: Select all

curl http://192.168.xxx.xxx:8080/json.htm?type=command&param=getlog&lastlogtime=0&loglevel=268435455
Response i get :

Code: Select all

{ "status" : "ERR" }
 
If i copy the same url to my browser i get perfecty i json respond with the log entries.
you could try with

Code: Select all

curl -s -X GET http://192.168.xxx.xxx:8080/json.htm?type=command&param=getlog&lastlogtime=0&loglevel=268435455"

Re: Need help : Lua reading log

Posted: Friday 31 August 2018 22:35
by zicht
Hi Waaren,

Thanx !!

Tried it with same result.
Somehow it works in every browser but with curl it reports an error.

Tried also other json commands, those work well in browser and with curl (setting a switch)
Just not the log.

SOLVED :

Code: Select all

	commando='curl "http://192.168.xxx.xxx:8080/json.htm?type=command&param=getlog"'
I added the " and it worked, thanks for ehm inspiring me to test a bit more

Re: Need help : Lua reading log

Posted: Saturday 01 September 2018 0:49
by waaren
zicht wrote: Friday 31 August 2018 22:35 SOLVED :

Code: Select all

	commando='curl "http://192.168.xxx.xxx:8080/json.htm?type=command&param=getlog"'
I added the " and it worked, thanks for ehm inspiring me to test a bit more
Yes sorry for omitting the first "
curl does not like the ? and & so they need to be escaped by adding a \ before them or put the whole http string between double quotes.