title: ESP8266 Send Data To a Website bad request
body: <p>I want to send some text to Apache Server, but i get some errors
  I'm a newbie in ESP2866. </p>
  
  <p>I can't find the reasons.</p>
  
  <p>I received: "400 Bad request"......<strong>.Request header field is missing ':'</strong> separator:<br>
  then  i received some errors:
  <strong>Wrong syntax....</strong></p>
  
  <p>I send following header to server: </p>
  
  <blockquote>
    <p>POST /receiver.php HTTP/1.1</p>
    
    <p>Host: 192.168.1.9</p>
    
    <p>Content-Type: application/x-www-form-urlencoded</p>
    
    <p>Content-Length: 20</p>
    
    <p>temp=35</p>
  </blockquote>
  
  <p>I use this code in Arduino:</p>
  
  <pre><code> String cmd,aaa;
   aaa="temp="+35;
   cmd= "POST /temp.php HTTP/1.1\r\n";
   cmd+="Host: 192.168.1.9\r\n";
   cmd+="Content-Type: text/plain\r\nContent-Length: "+aaa.length();
   cmd+="\r\n\r\n"+aaa+"\r\n\r\n";
  
  
   Serial.print("Sending to Server: ");
   aaa= "AT+CIPSEND=";
   aaa+=cmd.length();
   aaa+="\r\n";
  
   Serial.println(sendData(aaa, 1000));
   Serial.println(sendData(cmd,2000));
  
   delay(1000);
  </code></pre>
  
  <p>This is sendData function:</p>
  
  <pre><code>String sendData(String command, const int timeout)
  {
    String response = "";
  
    esp.print(command); // send the read character to the esp8266
  
    long int time = millis();
  
    while ( (time + timeout) &gt; millis())
    {
      while (esp.available())
      {
        // The esp has data so display its output to the serial window
        char c = esp.read(); // read the next character.
        response += c;
      }
    }
    return response;
  }
  </code></pre>