Re: GSM/GPRS Twitter Client

after sending AT+HTTPREAD I'm getting the truncated response printed but not the complete response.

what is received from sim900:

+HTTPREAD:39
{"status":"success","ms

actual response on the browser:

{"status":"success","msg":"good to go"}

could I get some guidance here why the response is getting truncated and how I can make it appear complete ?

my code:

void httpinit()
{
Serial.println("HTTP INITIALIZING");
mySerial.println("AT+SAPBR=3,1,"CONTYPE","GPRS"");
delay(2000);
DisplayGSMResponse();
mySerial.println("AT+SAPBR=3,1,"APN","INTERNET"");
delay(2000);
DisplayGSMResponse();
mySerial.println("AT+SAPBR=1,1");
delay(15000);
DisplayGSMResponse();
mySerial.println("AT+SAPBR=2,1");
delay(2000);
DisplayGSMResponse();
mySerial.println("AT+HTTPINIT");
delay(2000);
DisplayGSMResponse();
mySerial.println("AT+HTTPPARA="CID",1");
delay(2000);
DisplayGSMResponse();

Serial.println("Sending GET request to server...!!!");
mySerial.println("AT+HTTPPARA="URL","http://xxxYYY/\"");
delay(2000);
DisplayGSMResponse();
mySerial.println("AT+HTTPPARA="Content","application/json"");
delay(2000);
DisplayGSMResponse();
mySerial.println("AT+HTTPACTION=0");
delay(2000);
DisplayGSMResponse();
mySerial.println("AT+HTTPREAD");
delay(2000);
DisplayGSMResponse();
}

void DisplayGSMResponse()
{
if(mySerial.available())
{
String gsm_input="";
while(mySerial.available())
{
gsm_input+= (char)mySerial.read();
}
gsm_input.trim();
Serial.println(gsm_input);
delay(1000);
}
}

could I get some guidance here why the response is getting truncated and how I can make it appear complete ?

You expect that every call to DisplayGSMResponse() will have one complete packet, and only one complete packet, available to read. Neither is a valid assumption.