I use Arduino and ESP8266 for send and receive data with server. ESP8266 send(POST) data to server sucessfully. But when i use receice(GET) data (html,txt,xml...) from web server, My data are wrong. they are special characters.this problem takes me many days!
I can not understand!Please help me!
( My English is not good!)
This is code to read data from server:
String readData(long timeout)//const int timeout
{
String response;
char c ;
unsigned long time = millis();
while ( (time + timeout) > millis())
{
while (Serial1.available()>0)
{
// The esp has data so display its output to the serial window
// response = response + char(esp.read());
c =Serial1.read();
Serial.write(c);//At this, printed special data
response =response+ c; // read the next character.
}
}
return response;
}
This is my screen when it prints:
GET /data.txt HTTP/1.1
Host: 192.168.1.11
Accept: "text/html,ap
SEND OK
+IPD,274:HTTP/1.1 200 OK
Date: Fri, 19 Jun 2015 08:10:58 GMT
Server: Apae4(n nL. /.1
tdi , 58:G
g58e7
c-gbsone:
niceotptpnho
thank you!