I'm using library https://github.com/itead/ITEADLIB_Arduino_WeeESP8266.
Here's my code.
void loop{
counter(); // let's assume that this function is just counting in and out person in the room
// changing the value of variable count
uint8_t buffer[1024] = {0};
if (wifi.createTCP(HOST_NAME, HOST_PORT)) {
Serial.print("create tcp ok\r\n");
} else {
Serial.print("create tcp err\r\n");
}
char hello[];
strcpy(hello, "GET /indexphp?coount=");
strcat(hello, count);
strcat(hello," HTTP/1.1\r\nHost: www.test.com\r\nConnection:close\r\n\r\n");
wifi.send((const uint8_t*)hello, strlen(hello));
uint32_t len = wifi.recv(buffer, sizeof(buffer), 10000);
if (len > 0) {
Serial.print("Received:[");
for(uint32_t i = 0; i < len; i++) {
Serial.print((char)buffer[i]);
}
Serial.print("]\r\n");
}
}
when I'm creating TCP,releasing TCP and
wifi.send();