bool SubmitHttpRequest(String id, String kartid, String action, String times)
{
bool flag = false;
// Serial.println();
gprsSerial.println("AT+CSQ");
delay(100);
ShowSerialData();// this code is to show the data from gprs shield, in order to easily see the process of how the gprs shield submit a http request, and the following is for this purpose too.
gprsSerial.println("AT+CGATT?");
delay(100);
ShowSerialData();
gprsSerial.println("AT+SAPBR=3,1,"CONTYPE","GPRS"");//setting the SAPBR, the connection type is using gprs
delay(1000);
ShowSerialData();
gprsSerial.println("AT+SAPBR=3,1,"APN","0V0E.TMGS"");//setting the APN, the second need you fill in your local apn server
delay(4000);
ShowSerialData();
gprsSerial.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to the AT command mamual
delay(5000);
ShowSerialData();
gprsSerial.println("AT+HTTPINIT"); //init the HTTP request
delay(3000);
ShowSerialData();
gprsSerial.print("AT+HTTPPARA="URL",""+ serveradress + "?action=" + action + "&time=" + times + "&kartid1=" + kartid + "&id=" + id + "&u=xxx&p=xxxx&project_id=4&kartid=");
for (int letter = 0; letter < 1000; letter++) {
// char tempLetter = EEPROM.read(57 + letter);
gprsSerial.print(1 );
delay(100);
}
gprsSerial.print(""" );
gprsSerial.println("" );
delay(4000);
ShowSerialData();
gprsSerial.println("AT+HTTPACTION=0");//submit the request
delay(10000);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer.
//while(!mySerial.available());
ShowSerialData();
gprsSerial.listen();
delay(1000);
gprsSerial.println("AT+HTTPREAD");// read the data from the website you access
delay(300);
ShowSerialDataR(kartid, action, times);
gprsSerial.println("");
return false;
delay(100);
}