Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.
Direct requests from an ESP32 to a PHP endpoint on free hosting aren’t supported. What you’re seeing is the expected behaviour, and it can’t be turned off.
Every free InfinityFree account sits behind a browser security system. It only lets a request through if the client can run JavaScript and keep a cookie. That’s the /aes.js page setting a __test cookie. Your laptop browser passes the check, so you get your JSON. An ESP32 can’t run the JavaScript, so it gets the challenge page. The article lists REST APIs and automated scripts among the things that don’t work:
The article says the system is mandatory on free hosting. It also says premium hosting uses less restrictive protection, so APIs work normally there. Its options for API access are:
- Move the API to premium hosting.
- Host the API on a service built for that.
- Have your site make outbound requests instead. Outbound calls from your PHP code to other servers aren’t affected.
Here’s the article on API access:
I didn’t find a documented way to get an ESP32 past the challenge on a free account. If you want to keep the site and database on InfinityFree, the outbound route is the one that fits. The ESP32 would need to send its data to something that isn’t behind this check, and your site would then pull from it.