# Problem with Arduino Sending POST Data to InfinityFree PHP Server

**URL:** <https://forum.infinityfree.com/t/problem-with-arduino-sending-post-data-to-infinityfree-php-server/103998>\
**Category:** Hosting Support\
**Created:** [January 5, 2025, 11:26pm UTC](https://forum.infinityfree.com/t/problem-with-arduino-sending-post-data-to-infinityfree-php-server/103998 "2025-01-05T23:26:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ola\_Ali](https://forum.infinityfree.com/letter_avatar/ola_ali/32/6_22734026db12803ebb3e059622ac3534.png) [@Ola\_Ali](https://forum.infinityfree.com/u/Ola_Ali)\
**Post date:** [January 5, 2025, 11:26pm UTC](https://forum.infinityfree.com/t/problem-with-arduino-sending-post-data-to-infinityfree-php-server/103998/1 "2025-01-05T23:26:22Z")

</div>

Hello,

I am working on a student project involving an IoT-based poultry monitoring system. My setup includes the following:

1. **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.

1. **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.

1. **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.

1. **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.

1. **Troubleshooting Steps Taken:**

- Confirmed Arduino code is functioning by monitoring the serial output (HTTP requests and responses).
- Set file permissions for `post_log.txt` to `777` 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.

1. **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?

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [January 6, 2025, 1:54am UTC](https://forum.infinityfree.com/t/problem-with-arduino-sending-post-data-to-infinityfree-php-server/103998/2 "2025-01-06T01:54:06Z")

</div>

Its infinityfree’s security , click the link below for details

> [@Ensuring only web browsers can access your website](https://forum.infinityfree.com/t/ensuring-only-web-browsers-can-access-your-website/49353):
>
> InfinityFree is a website hosting service. That means that the hosting accounts we provided are intended for hosting websites. Websites contain pages that are accessed through web browsers. InfinityFree is not intended to be used for file sharing, API hosting, database hosting or background tasks/tools. To help enforce this, free hosting enforces a security system that makes sure that anyone trying to access your website is using a normal web browser. This is done by checking whether the web br…

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [January 13, 2025, 1:54am UTC](https://forum.infinityfree.com/t/problem-with-arduino-sending-post-data-to-infinityfree-php-server/103998/3 "2025-01-13T01:54:17Z")

</div>

Closed on January 13, 2025, 1:54am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
