Page 1 of 1
WGET Annex
Posted: Mon May 17, 2021 7:32 pm
by Michael S
Hello community, Hello cicciocb
I have a problem and I don't know if I didn't understand something or there is a bug here.
The code works with
ANNEX 1.42 and Esp 8266
but unfortunately not with
ANNEX 32 and ESP 32
There were tested 2 boards each.
I hope someone understands what I write here
Kind regards
Michael S
---------Code----------
let result$=""
onwgetasync syncload
gosub refresh_price
timer0 60000,refresh_Price
wait
Refresh_Price:
wgetasync "creativecommons.tankerkoenig.de/json/detail.php?id=cd8ba6a6-xxxxxxxx-a3ae-d31280b2585f&apikey=ccd8c3ca-f8ae-a0ac-441a-
fb7aexxxxxxx",443,1
name$ = json$(result$, "name"):name$=left$(name$,4)
rem ONWGETASYNC OFF
return
' --------------------------------------------------------------------------------------------------
syncload:
wlog "jmp to sub"
result$=wgetresult$
return
Re: WGET Annex
Posted: Mon May 17, 2021 8:16 pm
by cicciocb
HI Michael,
what is exactly your problem ?
I tried your code and seems to work, even if I receive an invalid answer probably because the parameters are not correct.
However, copying and pasting your code I found that the line 8 is separated in 2 parts going on the next line; this is invalid !
This is the answer that I receive.
Code: [Local Link Removed for Guests]
HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 17 May 2021 20:15:18 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: origin, x-requested-with, content-type, accept
Access-Control-Allow-Methods: GET
{"status":"error","ok":false,"message":"parameter error"}
For info, typing the same url in the browser, I have exactly the same json answer
Re: WGET Annex
Posted: Tue May 18, 2021 8:22 am
by Michael S
Halllo cicciocb
Maybe you can read the code better now.
The problem is that it works with ANNEX 1.42 on a 8266.
But not on a ESP32.
There it does not jump into the sub "syncload".
As said
ANNEX 32 does not work
Annex 1.42 works perfectly
Many greetings
Michael S
Code: [Local Link Removed for Guests]
let result$=""
onwgetasync syncload
gosub refresh_price
timer0 60000,refresh_Price
wait
Refresh_Price:
wgetasync "creativecommons.tankerkoenig.de/json/detail.php?id=cd8ba6a6-XXXX-1ed5-a3ae-d3XXXX2585f&apikey=ccd8c3ca-f8ae-a0ac-441a-fb7ae9bf2c91",443,1
name$ = json$(result$, "name"):name$=left$(name$,4)
' ONWGETASYNC OFF
return
' --------------------------------------------------------------------------------------------------
syncload:
wlog "jmp to sub"
result$=wgetresult$
return
Re: WGET Annex
Posted: Tue May 18, 2021 8:27 am
by Michael S
...It works perfectly in the browser window.
I get the correct JSON file.
I had to make the ID unrecognizable, of course
Re: WGET Annex
Posted: Tue May 18, 2021 8:59 am
by Fernando Perez
I am a bit lazy to give my email address to more companies to obtain a real API, but I have tried with the test API that they provide and, for me, your program works perfectly on an ESP32 loaded with "Annex32 Wifi 1.43 CAN BLE".
Code: [Local Link Removed for Guests]
onwgetasync syncload
gosub refresh_price
timer0 60000, refresh_Price
wait
Refresh_Price:
wgetasync "https://creativecommons.tankerkoenig.de/json/list.php?lat=52.521&lng=13.438&rad=1.5&sort=dist&type=all&apikey=00000000-0000-0000-0000-000000000002"
return
' --------------------------------------------------------------------------------------------------
syncload:
result$ = wgetresult$
wlog result$
wlog
name$ = json$(result$, "name")
wlog name$
return
Re: WGET Annex
Posted: Tue May 18, 2021 11:19 am
by cicciocb
I confirm what said by Fernando, it works well for me too.
What version of Annex32 are you using ?
Re: WGET Annex
Posted: Tue May 18, 2021 1:22 pm
by Michael S
Thank you both for the support
On the board is Annex32 Wifi 1.43 CAN BLE
I'll keep trying...
Many greetings
Michael S
Re: WGET Annex
Posted: Sat May 22, 2021 6:55 pm
by Michael S