For some reason I cannot submit values to my database. Calling the URL with parameters in the browser works flawlessly.
URL looks something like this: http://1.1.1.1/statussubmit.php?&ph=2&ec=1&temp=25&humidity=60&light=1&waterlvl=0
Sketch looks like this:
TCPClient client;
char server[] = "1.1.1.1";
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println("Hello Computer");
if (client.connect(server, 80)) {
Serial.println("connecting...");
client.println("GET /statussubmit.php?&ph=2&ec=1&temp=25&humidity=60&light=1&waterlvl=0 HTTP/1.1");
client.println("Host: 1.1.1.1");
client.println("User-Agent: Arduino/1.0");
client.println("Connection: close");
delay(5000);
}
else {
// Serial.println("Connection failed");
// Serial.println("Disconnecting.");
client.stop();
}
}
Any help appreciated!