• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Error -1 in project DIY Cloud Weather Station with ESP32/ESP8266 (MySQL Database and PHP)

Q&A Forum › Category: ESP32 › Error -1 in project DIY Cloud Weather Station with ESP32/ESP8266 (MySQL Database and PHP)
0 Vote Up Vote Down
vicente Fabregat Jardi asked 9 months ago

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?

2 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 9 months ago

Hello,
If you are following this project, but with a local installation:

  • DIY Cloud Weather Station with ESP32/ESP8266 (MySQL Database and PHP)

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

0 Vote Up Vote Down
vicente Fabregat Jardi answered 9 months ago

Thank you very much.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.