AT+HTTP command response?

Hi all,

I'm using Arduino UNO with SIM900 shield.
Currently I try to send HTTP POST request using AT command to my server.
Here is some of my code where inputString is a string in a JSON format.

void loop() {

if (millis() - tempo > Period) {
     sendLocInfo(jsonString);
     tempo = millis();
   }

   while (ConnectSerial.available()) {
     Serial.println(ConnectSerial.read());
   }
}

void sendLocInfo(char * inputString) {
  ConnectSerial.println("AT+SAPBR=1,1");                   // Enable GPRS
  delay(1000);
  ConnectSerial.println("AT+HTTPINIT");                    // Enable HTTP
  delay(100);
  ConnectSerial.println("AT+HTTPPARA=\"CID\",1");          // Set up the HTTP bearer profile identifier
  delay(100);
  ConnectSerial.println("AT+HTTPPARA=\"URL\",\"http://call1669.cpe.kmutt.ac.th/var/www/html/easylocate/calculate.php\"");  //Set the URL
  delay(100);
  ConnectSerial.println("AT+HTTPPARA=\"CONTENT\",\"application/json\""); // Set the content type to JSON
  delay(100);
  ConnectSerial.print("AT+HTTPDATA=");
  ConnectSerial.print(sizeof(inputString));
  ConnectSerial.println(",10000");
  delay(2000);
  ConnectSerial.println(inputString);
  delay(100);
  ConnectSerial.println("AT+HTTPACTION=1");                // Start the HTTP POST session
  delay(1000);
  ConnectSerial.println("AT+HTTPREAD");                    // Read the received data
  delay(100);
}

I got a response with a bunch of number.
I thought they were hex or ascii so I try to put them on some conversion website but there is no meaning.

65
84
43
71
83
78
13
10
13
10
48
49
51
57
53
48
48
48
55
49
50
49
49
50
51
13
10
13
10
79
75
13
10

Although they are different in each loop but this is the first set the response produced.
However, I have some problem to show the URL page on the server which when I try GET method, it response with 404 error but that's fine right now.

The question is shouldn't I get the same response as GET? Is this numbers response already correct?
How can I modify the code to get the correct result?

Cheers

I thought they were hex or ascii so I try to put them on some conversion website but there is no meaning.

Your codes is actually ASCII in decimal

it actually shows

AT+GSN

01395000[color=red]xxxxx[/color]

OK

(I removed the phone number, suggest you edit your post above and remove the end of the number for privacy)

you might miss a AT+HTTPTERM after your AT+HTTPACTION=1 and a AT+SAPBR=0,1" to disconnect GPRS

Oh, so it was decimal :confused:

But how can I print them to text?

Thanks

By telling the compiler you don't want to print an integer but a character

Serial.println([color=red](char)[/color] ConnectSerial.read())

The read() method returns an int, usually 2 bytes, which is used to return -1 if there is a read error otherwise the character you read is on the low byte of your int. So when you call directly println() the compiler sees the signature of read() as returning an int and thus calls the printing method asking to print an integer.