I am using SIM800c gsm module to send data to php server
These are the commands i am trying to send data
AT
AT+CPIN?
AT+CREG?
AT+CGATT?
AT+CSQ
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","airtelgprs.com"
AT+SAPBR=1,1
AT+SAPBR=2,1
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://axxxxxxxxxx.000webhostapp.com/conn.php"
AT+HTTPPARA="CONTENT","application/json"
AT+HTTPDATA=14,20000
{"name":"abc"}
AT+HTTPACTION=1
AT+HTTPREAD
AT+HTTPTERM
AT+SAPBR=0,1
And my php code is:
<?php
$servername = "localhost";
$username = "xxxxxx";
$password = "xxxxxxx";
$dbname = "xxxxxxxxx";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
} else{
}
$name=$_POST['data'];
$sql = "INSERT INTO info (inform)
VALUES ('$name')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
When i am using these codes to send data, I can find a entry in my php server but no data abc
is not visible.
I have tried GET method to send data where i put my data in the url
like this:
AT+HTTPPARA="URL","http://axxxxxxxxx.000webhostapp.com/conn.php?data=abc"
Using GET method shows the data perfectly.
Any ideas how to send it using POST????
Any help will be appreciated.
Thanks in advance