Arduino send POST request to XAMPP server

Hi Is there anyone that know how to POST to work on XAMPP?

I have tried arduino code and PHP code at another server and it works good.

But when I trying to run it on my local XAMPP server at a Windows 10 machine its not working.

I have google and try everything that need to switch on but nothing works and it looks like much information at internet is old and a lot has been change in XAMPP.

EDIT GET is working fine.

Show us your Arduino code and your PHP code aswell. Then we will be able to help you. Also you can send here phpinfo() output..

Hi
Here is my php and Arduino code.
The Arduino code is just the POST part.
Its working at another server but not at my local XAMPP server.

EDIT
If I change to client.println(“GET /sendlog.php?”); it is running the php file.

<?php 
$dbhost = 'localhost'; //mysql server address, it can be an ip address typically it is 'localhost'
$dbuser = 'test';    
$dbpass = 'test1234'; 
$dbname = 'huluControl'; //This is the name of your database on the mysql server

$conn = mysqli_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); 
mysqli_select_db($conn, $dbname);

$TempBoiler = 1;
$Temp50 = 6500;
$Temp150 = 1;
$Temp550 = 1;
$Temp1000 = 2;
$Temp1250 = 1;
$Temp1350 = 1;
$TempMisc = 1;
$TempOutside = 1;

$query = "INSERT INTO huluControl.HeatSystemLog(TempBoiler, Temp50, Temp150, Temp550, Temp1000, Temp1250, Temp1350, TempMisc, TempOutside) VALUES($TempBoiler, $Temp50, $Temp150, $Temp550, $Temp1000, $Temp1250, $Temp1350, $TempMisc, $TempOutside)";


if (!mysqli_query($conn, $query)) 
{
  echo("Error description: " . mysqli_error($conn));
}

mysqli_close($conn);

?>
if (client.connect("192.168.1.203",80))
    {
         Serial.println("Connected yourwebsite...");   // This isn't required, just for feedback
         Serial.println();
        
          client.println("POST /sendlog.php? HTTP/1.1");
          client.println();

          client.println("Host: 192.168.1.203");
          client.println("User-Agent: JohnSArduino/1.1");                          
          client.println("Connection: close");
          client.println("Content-Type: application/x-www-form-urlencoded");
       
          client.print("Content-Length: ");                                    
          client.print(txData1.length());
          Serial.println(txData1.length());                                            
          client.print("\n\n");
          client.print(txData1); 
          Serial.println("TXDATA1");
          Serial.println(txData1);  // after all of the required junk we send the data
          Serial.println("TXDATA1");
          int c = client.read();
        
         
    }   
     
    else
    {
         Serial.println("Connection Failed."); // Again the Serial is for feedback.   
         Serial.println();
         char c = client.read();
         
    }
    delay(5000); 


client.stop();
  
    }

Its working at another server but not at my local XAMPP server.

a) What have you changed in your XAMPP settings to allow other clients than localhost? d) What response to you get with the Arduino? Show the serial output c) Try to connect to your XAMPP Server from [u]another[/u] PC/smartphone - what response do you get from your XAMPP? d) Show WORKING FULL COMPLETE CODE only.

Sometimes i had problem at XAMPP when there was not any echo line.. blank page.... Arduino connected, but code was not executed at webserver (try to add some echo "OK"; at the end of your php file)

And try that Arduino code:

const char * host = "192.168.1.203";
String url = "/sendlog.php";
if (client.connect(host, 80)) {
  //IF YOU USE HTTP/1.1 YOU WILL RECEIVE CHUNK ENCODING FROM PHP FILE AND YOU MUST PROCESS IT MORE....
  //IF YOU USE HTTP/1.0 YOU WILL RECEIVE PLAINTEXT
  client.println("POST " + url + " HTTP/1.0");
  client.println("Host: " + (String)host);
  client.println("User-Agent: JohnSArduino");
  client.println("Connection: close");
  client.println("Content-Type: application/x-www-form-urlencoded;");
  client.print("Content-Length: ");
  client.println(txData1.length());
  client.println();
  client.println(txData1);
  while (client.connected()) {
    String line = client.readStringUntil('\n'); //HTTP HEADER
    Serial.println(line); //SHOW HTTP HEADER
    if (line == "\r") {
      break;
    }
  }
  String line = client.readStringUntil('\n'); //HTTP RESPONSE PAYLOAD (ONE ROW)
  Serial.println(line); //SHOW HTTP PAYLOAD

}