HTTP Bad Request from Arduino missing separator ':'

Hi guys,

Im getting an error after posting to a web server.

This is my php code:

$conex = mysql_connect("localhost", "user", "pwd");

    die("Couldn't connect to the server...

$db = mysql_select_db("test", $conex);

    die("Couldn't connect to the database...

$Estado_Boton = $_POST["Estado_Boton"];

$sql = "INSERT INTO example (name) VALUES ('$Estado_Boton') ";

$res = mysql_query($sql, $conex);


This is my Request code:

if (, 80)) {
       Serial.print("Connected to ");
        /* Send the request */
	//wifly.println("GET /query.php HTTP/1.0");
	wifly.println("POST /arduino/data_process.php HTTP/1.0");
	wifly.println("Host:"); // SERVER ADDRESS HERE TOO
        wifly.println("Content-Type: text/html; charset=utf-8");
        wifly.println("Content-Length: ");
        wifly.println("Connnection: close");
   } else {
       Serial.println("Failed to connect");

This is the server response:

HTTP Bad Request from Arduino missing separator ‘:’

I’ve looked around the web but all i found is some httpd related posts.

Anybody ever get this?

        wifly.println("Content-Length: ");

You are printing the data length on a separate line from the Content-Length: Shouldn't they be on the same line?


You mean it should be:

wifly.println("Content-Length: " + data.length());

Im not at desk right now so I can't try it. I just looked up an example and found that one. I just found a different one that doesn't even use Content-Length. So Ill try both options when I get back.

Im also not sure as to the order of the calls. The Connection: close being before the print(data)

Oh, I also just noticed that Content-Length is only using print, without new line. So that may be why its being printed like that.