Arduino connected to a ESP8266 module as a server

I'm having a hard time trying to understand how I can use my Arduino that has an ESP8266 WiFi module and a DHT temp and humidity sensor connected to it to display data over my local wifi to my raspberry pi 3. My Arduino is outside connected to my bee hives and my Pi3 is in my room. I can ping the ESP's IP address with success. Everything I read has to do with Ethernet, WiFi shield, or streaming to a website. I don't want to stream to a website and back to my Pi, just want to stay on my home network. Can anyone help me understand how to write a simple script to send data to my Pi? I'm getting my self more confused researching and now I have to ask for help.

Ps. I'm new to posting on forums, Arduino , raspberry pi, and networking.

You need to install a LAMP stack on the Pi. This includes Apache (a web server), MySQL (a database system) and PHP (a server-side scripting language).
Configure the Pi to use a fixed IP address, or configure DNS on your LAN. You could probably use mDNS as well, but I haven't tried that yet.

In the ESP8266 program, send an HTTP POST request to a PHP script on the Pi, containing the sensor data.
In the PHP script, take the data from the request, and insert it into the database.

If all you have to do is read a temperature sensor, I'd recommend to forget about the UNO, and program the ESP8266 directly, it'll make your life a whole lot easier.

In this Beginner's Guide to the ESP8266, you can find everything you need to know to program the ESP, and it also explains how HTTP (and all underlying protocols of the TCP/IP stack) work.

Here's the code I use to send 8 sensor values from the ESP to the database on the Pi:

It's a lot to take in, so I suggest trying to understand the HTTP protocol first. It is explained in chapter 7 of the guide.
Focus on HTTP-POST-char-array.ino first, then PHP/database.php, and then the .h files for the detailed implementation.


I’m testing on an Uno but actually have a Mega outside with hygrometers and water solenoids connected as well but temporarily have that part of the project shut down while I try sending the temp and humidity. After I successfully send the temp and humidity data, I will add back my hygrometers and solenoids to the mix.