Getting query
Posted: Thu Apr 09, 2015 1:15 pm
after days of searching, how to i retrieve data from a query on a website?
I am able to get the web page but i cannot get the ?id=
And when that is done I tried doing this but I always get esp8266.available()=0 or Serial.available =0
Where
I am able to get the web page but i cannot get the ?id=
Code: Select all
String webRequestII()
{
String startCommmand = "AT+CIPSTART=0,\"TCP\",\"somesite.com\",80\r\n\r\n";
String getCommand = "GET /query?id=2 HTTP/1.1\r\nHost: ";
getCommand += "google.com";
getCommand += ":80\r\n\r\n";
String sendCommand = "AT+CIPSEND=0," + String(getCommand.length()) + "\r\n";
sendData(startCommmand, 1000);
sendData(sendCommand, 1000);
sendData( getCommand, 1000);
}
And when that is done I tried doing this but I always get esp8266.available()=0 or Serial.available =0
Where
Code: Select all
String sendData(String command, const int timeout)
{
String response = "";
esp8266.print(command);
delay(timeout);
while (esp8266.available()) {
char c = esp8266.read();
response += c;
digitalWrite(9, HIGH);
delay(50);
digitalWrite(9, LOW);
delay(50);
}
delay(1000);
Serial.println(response);
return response;
}