HttpClient.get() fails with -1

Mike1997
Posts: 14
Joined: Fri May 10, 2019 6:57 am

HttpClient.get() fails with -1

Postby Mike1997 » Mon May 18, 2020 1:33 pm

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:

Code: Select all

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!


Who is online

Users browsing this forum: Baidu [Spider] and 53 guests