3
Good afternoon to all!,
I am developing a project that consists in the communication of a module SIM900 with an application, and doing the interaction of the two will be a server WEB + Database.
The APP, Database and PHP page items are already working perfectly.
PROBLEM: I am having problem in the communication of module SIM900 by the POST method with the page that will make the "ADD" of the information in the Mysql database.
I was able to add the information to the database using the GET method (via URL)
AT+SAPBR=1,1
AT+HTTPINIT
AT+HTTPPARA="URL","site/add.php?variável1=xx&Variavel2=xx&Variavel3=xx"
AT+HTTPACTION=0
However for security reasons I have to use the POST method, and there is the problem... When I try to send the data anyway by Arduino+sim900 (AT+HTTPDATA,AT+CIPSEND or some other), simply "empty" information arrives to me on the site and consequently "empty" values are added in the database as in the image below:
Current code of the ADD.php page in the Database:
include("connect.php");
$link=Connection();
$Bateria=$_POST["Bateria"];
$Odometro=$_POST["Odometro"];
$Consumo=$_POST["Consumo"];
$Carro_Padrao=$_POST["Carro_Padrao"];
$query = "INSERT INTO `u984057597_app`.`SMS_Recebidos`(`timeStamp`,`Bateria`,`Odometro`,`Consumo`,`Carro_Padrao`) VALUES (DATE_SUB(now(), INTERVAL 3 HOUR),'".$Bateria."','".$Odometro."','".$Consumo."','".$Carro_Padrao."')";
mysql_query($query,$link);
mysql_close($link);
Has anyone had this same problem and managed to solve it? , is it necessary to have an extra command on the add.php page? (it receives the data from Arduino)
Thank you all from now on!
Thiago, welcome. Edit your question and add the code, without using the image as this makes it difficult to verify it. I recommend reading the Tour
– Marcelo de Andrade
Thanks @Marcelodeandrade, I’ve edited the same and I’m checking the Tour.
– Thiago Moreira