andihong
Member level 1
helo, i have a GSM shield, i want to send the data to php, but it not work..
i use library https://www.open-electronics.org/arduino-gsm-shield/
and using POST example from this https://www.open-electronics.org/the-gsmgprs-gps-shield-some-http-connections-examples/
but it not work, here the serial output from UNO
Here the httpPOST code
and the PHP code
here the conclution is :
1. i have tried httpGET , its works. but not with httpPOST
2. APN is working
please help..
i use library https://www.open-electronics.org/arduino-gsm-shield/
and using POST example from this https://www.open-electronics.org/the-gsmgprs-gps-shield-some-http-connections-examples/
but it not work, here the serial output from UNO
Code:
GSM Shield testing.
ATT: OK
RIC:
OK
DB:ELSE
ATT: OK
RIC:
OK
DB:ELSE
ATT: OK
RIC:
OK
DB:ELSE
ATT: OK
RIC:
OK
DB:CORRECT BR
ATT: OK
RIC:
OK
ATT: OK
RIC:
OK
ATT: OK
RIC: ATE0
OK
ATT: OK
RIC:
OK
ATT: OK
RIC:
OK
ATT: OK
RIC:
OK
ATT: OK
RIC:
OK
ATT: +CPMS:
RIC:
+CPMS: 34,40,34,40,34,40
OK
ATT: OK
RIC:
OK
ATT: SHUT OK
RIC:
SHUT OK
status=READY
ATT: ERROR
RIC:
ERROR
DB:STARTING NEW CONNECTION
ATT: SHUT OK
RIC:
SHUT OK
DB:SHUTTED OK
ATT: OK
RIC:
OK
DB:APN OK
ATT: OK
RIC:
OK
DB:CONNECTION OK
ATT: ERROR
RIC:
1*.***.***.***
DB:ASSIGNED AN IP
status=ATTACHED
ATT: OK
RIC:
OK
DB:RECVD CMD
ATT: CONNECT OK
RIC:
OK
ATT: OK
RIC:
STATE: IP STATUS
CONNECT FAIL
DB:NOT CONN
ATT: OK
RIC:
OK
STATE: IP STATUS
CONNECT FAIL
DB:RECVD CMD
ATT: CONNECT OK
RIC:
OK
STATE: IP STATUS
CONNECT FAIL
DB:NOT CONN
ATT: OK
RIC:
OK
DB:RECVD CMD
ATT: CONNECT OK
RIC:
OK
ATT: OK
RIC:
STATE: IP STATUS
CONNECT FAIL
DB:NOT CONN
Here the httpPOST code
Code:
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "inetGSM.h"
InetGSM inet;
int k = 0;
int j = 0;
char msg[150];
boolean found = false;
char data;
int numdata;
char inSerial[50];
int i = 0;
boolean started = false;
void setup()
{
Serial.begin(9600);
Serial.println("GSM Shield testing.");
if (gsm.begin(2400)) {
Serial.println("\nstatus=READY");
started = true;
}
else Serial.println("\nstatus=IDLE");
if (started) {
if (inet.attachGPRS("internet.wind", "", ""))
Serial.println("status=ATTACHED");
else Serial.println("status=ERROR");
delay(1000);
inet.httpPOST("www", 80, "/test/test.php", "name=Marco&age=24", msg, 50);
}
};
void loop()
{
serialswread();
};
void serialswread() {
gsm.SimpleRead();
}
and the PHP code
Code:
<?php
echo $_POST["name"];
echo $_POST["age"];
?>
here the conclution is :
1. i have tried httpGET , its works. but not with httpPOST
2. APN is working
please help..