POST request not working I'm following a guide on storing sensor data to MYSQL: 

Guide

I'm using different sensors but my POST request is getting any results to my server. For now, I'm only storing temperature. 

Here is my code for saving data:

void sendData(double input){

String data = "sensorid=3000000&amp;temp=" + doubleToString(input, 2) + "&amp;hum=1.2";

if(client.connect("192.168.1.50",80)){
    client.println("POST /arduino/add.php HTTP/1.1");
    client.println("Host: 192.168.1.50");
    //client.println("User-Agent: Arduino/1.0");
    //client.println("Connection: close");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.print("Content-Length: ");
    client.print(data.length());
    client.println();
    client.print(data);

    Serial.println("Sent data: " + data);
}

if(client.connected()){
   client.stop(); 
}
delay(300000);
}


I've commented out two headers since it did not give any other results. My Serial.println gives: Sent data: sensorid=3000000&amp;temp=24.00&amp;hum=1.2
Which means that the arduino is connected to the giving IP-adress and that my Request data is as I want. They are also working perferct when I'm testing with Requestmaker. So I'm pretty sure my error comes from the way I'm doing the request here.

So do you have any idea how I can solve this? Or how I can debug it t
Answered by Edgar Bonet

There needs to be an empty line between the headers and the body of the request. Therefore you have to println() (not print()) the end of the last header.



Please accept this answer so the system knows it is the correct one.