Hello,
I am working on a student project involving an IoT-based poultry monitoring system. My setup includes the following:
- Hardware:
- Arduino ESP32 is connected to DHT11 and MQ135 sensors to collect temperature, humidity, NH3, and CO2 data.
- The Arduino sends data via an HTTP POST request to a PHP script hosted on an InfinityFree server.
- Software:
- The PHP script (
sensordata.php
) is designed to receive the sensor data and insert it into a MySQL database. - The server has a file (
post_log.txt
) to log all incoming POST requests for debugging.
- What is Working:
- The Arduino successfully connects to WiFi and builds the HTTP request correctly.
- The script works perfectly in my local XAMPP environment, receiving and storing the data as intended.
- What is Not Working:
- When hosted on InfinityFree:
- The Arduino sends the POST request, but the server either does not receive it or fails to process it.
- The
post_log.txt
file does not update, and no data appears in the database.
- Testing the PHP script on Postman shows a redirection error that includes a script requiring JavaScript (
aes.js
). After this step, the response doesn’t confirm successful data reception.
- Troubleshooting Steps Taken:
- Confirmed Arduino code is functioning by monitoring the serial output (HTTP requests and responses).
- Set file permissions for
post_log.txt
to777
to ensure the script can write to it. - Tested the PHP script manually via Postman, where it produces the expected “Data received” response locally but not on InfinityFree.
- Ensured the database credentials and connections are correct in the script.
- Request for Help:
- Could this issue be related to InfinityFree’s restrictions on HTTP requests, file writing, or redirects involving
aes.js
? - If so, is there a way to bypass these limitations or configure my server/files to allow POST requests from an Arduino device?