I’m doing a simple projecto where the goal is to read values from a sensor em send them to a MySQL database (phpMyAdmin) using Wifi.
I base myself on the project Send Sensor Readings via Email (pag. 192 of the manual). But instead of a POST request I’m trying to use a GET request.
To do so, i’m using a ESP32-WROOME-32 board and a XAMPP local server on my machine.
I have a .php file responsible for receive the GET request, establish the connection to the DB and insert the values on the DB.
save_data_GET.php
https://pastebin.com/C062F86c
The server is working fine. If I type < http://localhost:8090/esp32/save_data_GET.php?sensor1=6 > The value 6 is inserted correctly in my DataBase.
The problem came when i try to do the GET request from the ESP32
boot.py:
https://pastebin.com/RvY1vq1N
It always gives me the following error:
#########################################
Connection successful
(‘10.12.81.65’, ‘255.255.255.0’, ‘10.12.81.254’, ‘10.12.68.200’)
Traceback (most recent call last):
File “boot.py”, line 18, in <module>
File “urequests.py”, line 108, in get
File “urequests.py”, line 58, in request
OSError: [Errno 104] ECONNRESET
#########################################
Complete output:
Can anyone help me with this?
This should heve been a simple mission, but i’ve been stuck with it for over a week…
———————————————————————————————————————–
And by the way
Awsome job guys!
I think no one have soo much content (high quality) on this matter of MicroPython.
You definitely get me fired up to learn more MicroPython.
Thank you so much!
Hello Pedro, I hope you are doing well and I apologize for taking so long to get back to you, but I’ve been with very limited Internet for the last couple of days. I’m finally catching up and I’ll try to give you a faster response.
The error should be very easy to solve:
response = urequests.get("http://YOUR_IP_ADDRESS_PHP_SERVER:8090/esp32/save_data_GET.php?sensor1=6")
localhost only works if your using the device with the same IP address, you must use the IP address when sending an HTTP request.
Let me know if that solves your problem. Thanks for your patience!