Br1
Newbie level 4
First of all, good day to all.
My goal is to POST variables to my webserver usign GPRS modem SIM900.
For testing purposes, SIM900 modem is connected to PC via serial port with a MAX232 in between, running 19200,8,N,1. No Flow control.
My webserver: Apache with PHP 5.
Software used: Hyperterminal, Tera Term and other terminal emulators.
Serial communication is Ok, sending and receiving characters all right.
The problem (That has been driving me mad since a week now :-x): Webserver accepts with no problems POST from regular HTML Forms and from a Firefox plugin that sends POST: Httprequester. I monitor the received headers and variables are correctly received and parsed by PHP. HOWEVER!!, webserver (or PHP) is not accepting the POST when sent from SIM900. Internet communication is done Ok as I receive the return diagnostic echos that have programed from server.
The returned text from the server is an echo of the complete POST. I read it from the SIM900 using terminal... and it is OK!!! I don't understand.
I think that the AT command sequences are Ok, and there is something wrong with the actual POSTing that the SIM900 does. But is also very likely that I'm wrong! Lol.
AT commands that I send (Configuring CR+LF as line termination):
When entering AT commands, no errors returned.
After the AT+HTTPREAD command, I get exactly the POST sent, but no POST variables.
My PHP at webserver:
Also tried setting the content type using AT command:
But it didn't help. I don't know if this command is supported in my SIM900 firmware version: 1137B06SIM900M64
Tried as well the TCP approach (as opposed to the previous HTTP approach) using AT+CSTT, AT+CIICR, AT+CIPSTART and AT+CIPSEND. Same negative results.
I guess you must be tired and a little bit angry after reading the looonngg post. :evil: That is also how much upset I am. I need to solve this.
I will appreciate any input.
Is it the SIM900 config? Are the line ends and carraige returns not correct when entering POST data? :?:
Thank you communtity!
Best regards,
Br1
My goal is to POST variables to my webserver usign GPRS modem SIM900.
For testing purposes, SIM900 modem is connected to PC via serial port with a MAX232 in between, running 19200,8,N,1. No Flow control.
My webserver: Apache with PHP 5.
Software used: Hyperterminal, Tera Term and other terminal emulators.
Serial communication is Ok, sending and receiving characters all right.
The problem (That has been driving me mad since a week now :-x): Webserver accepts with no problems POST from regular HTML Forms and from a Firefox plugin that sends POST: Httprequester. I monitor the received headers and variables are correctly received and parsed by PHP. HOWEVER!!, webserver (or PHP) is not accepting the POST when sent from SIM900. Internet communication is done Ok as I receive the return diagnostic echos that have programed from server.
The returned text from the server is an echo of the complete POST. I read it from the SIM900 using terminal... and it is OK!!! I don't understand.
I think that the AT command sequences are Ok, and there is something wrong with the actual POSTing that the SIM900 does. But is also very likely that I'm wrong! Lol.
AT commands that I send (Configuring CR+LF as line termination):
Code:
AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","internet.ctimovil.com.ar"
AT+SAPBR=3,1,"USER","ctigprs"
AT+SAPBR=3,1,"PWD","ctigprs"
AT+SAPBR=1,1
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://myserveraddress/comm.php"
AT+HTTPDATA=137,5000
POST http://myserveraddress/comm.php
Content-Length: 414
Content-Type: application/x-www-form-urlencoded
var_a=444&var_b=sample+data
AT+HTTPACTION=1
AT+HTTPREAD
When entering AT commands, no errors returned.
After the AT+HTTPREAD command, I get exactly the POST sent, but no POST variables.
Code:
POST NOT RECEIVED CORRECTLY. 1. 2. 3. POST http://myserveraddress/comm.php
Content-Length: 414
Content-Type: application/x-www-form-urlencoded
var_a=444&var_b=sample+data
My PHP at webserver:
PHP:
<?php
if (isset($_POST['var_a'])) {
//Read POST data
$var_a = $_POST['var_a'];
$var_b = $_POST['var_b'];
echo "OK";
}
else {
//Diagnostic echoes
echo "POST NOT RECEIVED CORRECTLY. ";
echo "1. ".$_POST['var_a'];
echo "2. ".$_POST['var_b'];
echo "3. ".$HTTP_RAW_POST_DATA;
}
?>
Also tried setting the content type using AT command:
Code:
AT+SAPBR=3,1,"CONTENT","application/x-www-form-urlencoded"
Tried as well the TCP approach (as opposed to the previous HTTP approach) using AT+CSTT, AT+CIICR, AT+CIPSTART and AT+CIPSEND. Same negative results.
I guess you must be tired and a little bit angry after reading the looonngg post. :evil: That is also how much upset I am. I need to solve this.
I will appreciate any input.
Is it the SIM900 config? Are the line ends and carraige returns not correct when entering POST data? :?:
Thank you communtity!
Best regards,
Br1