I'm programming my ESP32 with the ArduinoIDE and have a problem with HTTP GET. What I'm doing:
-
the ESP32 connects as WiFi client to an existing WiFi network using a static, fixed IP
-
a webserver is started which provides a webpage for OTA firmware update -> this works, the webpage is accessible via the static IP
-
using HttpClient I try to GET an other, remote webserver, but this fails
This is the code I'm using for the HTTP GET call:
static WiFiClient wifi;
HttpClient wlanHttp=HttpClient(wifi,"my.server.tld");
wlanHttp.get("/setpos.php?id=DEADBEEF"); // -> this fails with error code -1
wlanHttp.responseStatusCode(); // follow-up error -1
wlanHttp.stop();
Any idea what goes wrong here?
Thanks!