Hello, I have a problem with the code of the ESP32, I am using a local mysql database with the tabl you provide, I can see the results and the graphics but when putting the code in the ESP32 always returns Error:-1. I checked that the file exists (I did a Ctrl+click on the link and opened it), but continued happening error.
I have tried different configurations for servername:
serverName = “http://127.0.0.1/random/esp-post-data.php”;
serverName = “http://localhost/random/esp-post-data.php”;
serverName = “127.0.0.1/random/esp-post-data.php”;
serverName = “localhost/random/esp-post-data.php”;
All open the file by ctrl+click
httpRequestData: api_key=tPmAT5Ab3j7F9&sensor=BME280&location=Office&value1=24.75&value2=49.54&value3=1005.14
09:55:29.742 -> Error code: -1
I’m using “ESP_HTTP_POST_MySQL.ino” but I try to use HTTPS version too.
SOS
Can you help me?
Hello,
If you are following this project, but with a local installation:
In your serverName variable:
const char* serverName = "https://example.com/esp-post-data.php";
The URL must be the device IP address (it can’t be 127.0.0.1 or localhost)… You need to go to your router and find the device’s IP address that is hosting the web page. It should look something like this:
const char* serverName = "http://192.168.1.98/esp-post-data.php";
Regards,
Rui