Hello,
I wrote simple webserver on ENC28j60. To arduino also is connected a cellphone.
Webserver parses querystring and fireing function to send sms.
I have to concat querystring, but I can save only string which length is <= 62. I think, that string is not good solution for this - any ideas ?
I’m getting from arduino this:
GET /?SMS78593244444789789796796796796796789789797897897890978 HTTP/1.1
Host: 192.168.1.25
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
and I need to save to my variable a piece of first line.
My code
void loop () {
word len = ether.packetReceive();
word pos = ether.packetLoop(len);
if(strstr((char *)Ethernet::buffer + pos, "GET /?SMS") != 0) {
String str((char *)Ethernet::buffer + pos);
Serial.println(str);
int index = str.indexOf(" HTTP");
Serial.println(index);
String number = str.substring(9,18);
Serial.println(number);
String message = str.substring(18,index);
Serial.println(message);
}
}
My output:
62 // index
785932444 // phone number
44789789796796796796796789789797897897890978 // text message
But I posted maximum length of text message. If I browse arduino page with one char more in query string, my message variable wll be empty , but why ?
Edit: I Can get a string with length between ~60 and ~64 - in each run of arduino program (after reset for example) those values are a bit different