Hi,
have anyone gets readind the response of an http request with this modeule ?
I got to send information more or less every 10 seconds. But when I try to get the response of the http the socket closes before i got the data,
This is working ok:
sprintf(cTemHum,"fTemper=%s&fHumita=%s HTTP/1.1",cTemper,cHumita);
Serial.print("cTemHum:");
Serial.println(String(cTemHum));
String request="GET /arduino/guardaTemHum.php?tTipTem=Celsius&"+String(cTemHum); //+"&fHumita="+String(cHumita);
// we're now connected and can send HTTP packets!
int packetLength = 26+host.length()+request.length()+useragent.length(); // 26 is size of the non-variable parts of the packet, see SIZE comments below
Serial.println("HTTP packet"); //Serial.println(String(packetLength));
cell.print("AT+SDATATSEND=1,"+String(packetLength)+"\r");
waitFor('>'); // wait for GSM module to tell us it's ready to recieve the packet
cell.print(request+"\r\n"); // SIZE: 2
cell.print("Host: "+host+"\r\n"); // SIZE: 8
cell.print("User-Agent: "+useragent+"\r\n\r\n"); // SIZE: 16
cell.write(26); // ctrl+z character: send the packet
delay(200);
waitTil("OK"); if (GPRS_Error) return ;
sockAllSend=false;
sendATCommand("AT+SDATASTATUS=1"); if (GPRS_Error) return ;
delay(500);
nNumIte=1;
while (!sockAllSend && sockStatusReady && nNumIte++<30)
{
sendATCommand("AT+SDATASTATUS=1"); if (GPRS_Error) return ;
// delay(500);
}
if (nNumIte>=30) { GPRS_Error=true; return; }
sendATCommand("AT+SDATASTATUS=0"); if (GPRS_Error) return ;
sendATCommand("AT+SDATASTART=1,0"); if (GPRS_Error) return ;
sendATCommand("AT+CGACT=0,1"); if (GPRS_Error) return ;
delay(1000);
}
buy when I try to read: can’t get it !
nNumIte=1;
waitTil("+STCPD:1"); if (GPRS_Error) return ;
sendATCommand("AT+SDATAREAD=1"); if (GPRS_Error) return ;
CME ERROR: 21 Invalid index
STCPC:1 , comes before READ data !!!
HELP PLEASE !!
Thank’s
Oscar