-->
Page 1 of 1

Getting query

PostPosted: Thu Apr 09, 2015 1:15 pm
by pinktoadette
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=

Code: Select allString 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 allString 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; 
}

Re: Getting query

PostPosted: Sat Oct 17, 2015 1:24 am
by robofred
This is exactly my issue. I'm trying to get data from the web to turn on/off LEDs on my Arduino...

I can print the content (+IPD) to my Serial, but I cannot use that data in any way.

Please help!!!

/Fred