Hi
Im using ESP8266 lib and it requires char* as a request param.
Now I need to compose that request char* variable so it can put var in it.
Static Request char* looks like that
char* request = "GET /centralne.php?temp=24 HTTP/1.1\r\nHost: ampio.leszek-wroblowski.pl \r\nConnection: close\r\n\r\n";
I want to dynamicly change temp=24 to differend val.
How can I make that?
Either use a "printf" type formatting routine or split up the request in two strings, send string 1 then the number then string 2.
char buffer0[150], buffer1[10];
int16_t tempVar = 25;
strcpy(buffer0, "GET /centralne.php?temp=");
itoa(tempVar, buffer1, 10);
strcat(buffer0+strlen(buffer0), buffer1);
strcat(buffer0+strlen(buffer0), " HTTP/1.1\r\nHost: ampio.leszek-wroblowski.pl \r\nConnection: close\r\n\r\n");
horace
4
see post #23 of
http://forum.arduino.cc/index.php?topic=525702.new#new
function getPage() for examples of adding information to a GET request using sprintf() and strcat()