0

I have a very simple php web page that simply does "echo 0". When you type in the correct address, all you see is 0 on the page. So this is fine. I am trying to activate this php page with my arduino code and get this "0" from the site, however it keeps returning this "HTTP/1.1 200 OK" instead of this "0". What am I missing? Here is the arduino code that is relevant...

void printWEB(WiFiClient client) {

if (client.connect(localServer, 80) == 1) {
client.print("GET /waterStatus.php?username=test&device_column=d1");  
client.println(" HTTP/1.1"); // Part of the GET request
client.println("Host: www.MYURL.com");
client.println("User-Agent: ESP8266/1.0");
client.println("Connection: close");
client.println();


 unsigned long timeoutP = millis();
 while (client.available() == 0) {
   if (millis() - timeoutP > 10000) {
      Serial.print(">>> Client Timeout: ");
      Serial.println("www.MYURL.com");
      client.stop();
      return;
   }
 }
  while(client.available()){
    String retLine = client.readStringUntil('\r');
    Serial.println(retLine);
    break; 
  }
}
delay(1000);

}

this last line "Serial.println(retLine);" is what I am expecting to be 0 but it is not.

Justin Oberle
  • 502
  • 3
  • 22

0 Answers0