title: POST request on a webserveur using Arduino Ethernet shield
body: <p>First of all, sorry for my bad English, I'm French. :)</p>
  
  <p>OK, so my goal is to send toward a web server a data of temperature at regular time. I use a LAMP server on a Raspberry Pi computer and the temperature is measured from an Arduino board linked to an Ethernet shield. For this purpose I set a POST request on the Arduino side to send the value of the variable "temp" to the server. </p>
  
  <p>This part seems to work properly because the result to the <code>client.read()</code> function is good and match to the result of the page test.php that I host on my Raspberry Pi.</p>
  
  <p>Here you can see my Arduino script:</p>
  
  <pre><code>#include &lt;Ethernet.h&gt;
  #include &lt;SPI.h&gt;
  
  byte mac[] = {  0x90, 0xA2, 0xDA, 0x0D, 0xF6, 0xFF }; 
  byte ip[] = {  192, 168, 0, 9};
  byte gateway[] = { x,x,x,x };           
  
  EthernetClient client;
  
  String temp= "data=5";  
  
  void setup()
  {
  Ethernet.begin(mac, ip, gateway);
  Serial.begin(9600);
  Serial.println(Ethernet.localIP());
  delay(1000);
  delay(1000);
  Serial.println("connecting...");
  
  if (client.connect("192.168.0.55",80))
  {                                 
  Serial.println("Sending to Server: ");                    
  client.println("POST /test.php HTTP/1.1");           
  Serial.print("POST /test.php HTTP/1.1");           
  client.println("Host: 192.168.0.55");
  client.println("Content-Type: application/x-www-form-urlencoded");
  client.println("Connection: close");
  client.println("User-Agent: Arduino/1.0");
  client.print("Content-Length: ");
  client.println(temp.length());
  client.println();
  client.print(temp);
  client.println();                                           
  }
  
  else
  {
  Serial.println("Cannot connect to Server");               
  }
  
  }
  
  void loop()                                           
  {        
  if (client.available()) {
  char c = client.read();
  Serial.print(c);
  }
  
  if (!client.connected()) 
  {
  Serial.println();
  Serial.println("disconnecting.");
  client.stop();
  for(;;)
    ;
  }                               
  
  }
  </code></pre>
  
  <p>And this is my file test.php :</p>
  
  <pre><code>&lt;?php
  echo 'Temperature = ' . htmlspecialchars($_POST["data"]) . '!';
  ?&gt;
  </code></pre>
  
  <p>The result of client.read() on the Arduino serial terminal is 5, that's proved that the POST request and PHP part are working.
  However, if I go on my browser at the url : 192.168.0.55/test.php, only "Temperature = " is displayed. The value (5) is missing.
  So if somebody know how can I display the value directly on my browser, it helps me a lot.</p>
  
  <p>Regards
  Guillaume</p>