How to send Arduino Yún Post Request to localhost? I've been trying to send data from my Arduino Yun to a local server using XAMPP. My code is shown below. In the serial monitor of the Arduino Yún, it shows connected and prints the data string, but in the server nothing is showing up. I don't know what's wrong. Maybe this doesn't work on a localhost? Any help would be much appreciated.

I've updated the Arduino code from something I found here.

send_data_ws.ino

#include &lt;Bridge.h&gt;
#include &lt;Console.h&gt;
#include &lt;FileIO.h&gt;
#include &lt;HttpClient.h&gt;
#include &lt;Mailbox.h&gt;
#include &lt;Process.h&gt;
#include &lt;YunClient.h&gt;

IPAddress server(192,168,1,200); 
YunClient client;

String parametri="";
int x1,x2,x3;

void setup() {
  Bridge.begin();
  Serial.begin(9600);
  pinMode(A0,INPUT);
  pinMode(A1,INPUT);
  pinMode(A2,INPUT);
  String parametri ="";
  delay(2500);
  Serial.println("connecting...");
  x1 = analogRead(A0);
  x2 = analogRead(A1);
  x3 = analogRead(A2);
  if (client.connect(server, 80)) {
    Serial.println("connected");
    delay(2500);
    parametri="x1="+String(x1)+"&amp;x2="+String(x2)+"&amp;x3="+String(x3);
    client.println("POST /arduino/index.php HTTP/1.1");
    client.print("Content-length:");
    client.println(parametri.length());
    Serial.println(parametri.length());
    Serial.println(parametri);
    client.println("Connection: Close");
    client.println("Host:192.168.1.200");
    client.println("Content-Type: application/x-www-form-urlencoded");
    client.println();
    client.println(parametri);     
 } else {
   Serial.println("connection failed");
 }
}

void loop() {
  if (client.available()) {
    char c = client.read();
    Serial.print(c);  
  }
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;;);
  }
}


index.php

&lt;?php
echo 'running....';
if ($_SERVER["REQUEST_METHOD"] == "POST"){
    $x1 = $_POST['x1'];
    $y1 = $_POST['x2'];
    $z1 = $_POST['x3'];
    echo 'x1: ' . $x1 . '&lt;br&gt;x2: ' . $x2 . '&lt;br&gt;x3:' . $x3 . '&lt;br&gt;';
}
?&gt;




The Serial Monitor shows the PHP code using client.read() and as you can see it displays the data I sent to the PHP file, but in my server nothing shows up, only the running.... line shows up.
There needs to be an empty line between HTTP headers and data.

You need to end the Content-Length header line with

client.println(data.length());


so that the client.println(); inserts an empty line.