Sending data via HTTP Post from Arduino to website

Hi,

I am trying to send data from my arduino (using GPRS) to a website hosted on here. (Mods I have read a post similar to this but that didn’t solve my issue and it’s closed now so I can’t ask questions in there).

The problem I am having is that the code I have tested works on http dump websites like “posttestserver(dot)com/post(dot)php”. However, when I try to send it to my website to the following address “http://gpsthird.000webhostapp.com/arduino.php” I am not receiving anything.

in the php file I have the following code:
<?php
$value= $_POST[‘value’];
echo "Data Received from Arduino = ".$value;
?>

I have tested this HTTP post requests form different applications to see if it was my arduino code but I have had no luck. Can someone please guide me on how to make it work?

I am a complete novice in this part of programming, so please do excuse me if I am sounding very stupid.

Maybe try the get method?

I have tried both with no result.

Have you by any chance got a simple example that you know works that I can have a look at? I haven’t found that many helpful parts online to do with this.

$value = $_GET[‘value’];
echo ‘Data received from Arduino =’. $value;

As I have said before I have already tried both the post and get method with no luck. Are there any conditions for thePOST from another device that have to be set (like a secret key)?
Also by ending a HTTP post using programs like telerik fiddler I still can’t seem to have anything visible on the website.

I was able to fix it by writing the data received from the HTTP Post to text file. I wan’t able to view the data on the same page for some reason.

Thanks for your help anyway

Hi @YasA

Most likely it can be a programming issue with your arduino. I strongly recommend you to use postman to do your testing.

Additionally,

  • Use $_POST if you use POST request
  • Use $_GET if you use GET request
  • But, you can use $_REQUST for above both (You don’t need to change the variable while testing. But Remember to change it to $_POST OR $_GET in production mode for some security reasons)