ESP32 Feather- POST method

Here is a small code snippet used in a IoT project. All it does is to update the server with a preformatted string using the POST method.

I am just giving the snippet alone to be brief as the process logging on to a WiFi network, receiving data via Serial from another device , parsing etc are all are working fine and so not copied here. Even this POST method works at time and I get a 200 response but the data always posted is NULL or so says my counterpart who handles the server side code PHP code.

Just wanted to check if anything is basically improper with the code below as mostly I get a response of -1 or at times 403.

void postMachineData () {

  HTTPClient http;                     //Declare object of class HTTPClient

  digitalWrite(13, HIGH);

  http.begin("http://xyz.abcdefgh.in/datacoll.php");                     //Specify request destination
  http.addHeader("Content-Type", "Application/x-www-form-urlencoded" );   //Specify content-type header

   sprintf(postData, "%s|%s|%s|%s|%s|%s|%s|%s|%s", machineID,date,realTime,powerStatus,oprnStatus,kWh,dutModel,dutTotal,dutPass);

  int httpCode = http.POST(postData);   //Send the request

  Serial.print( " POSTed to Server...");
  Serial.println(postData); 

  String payload = http.getString();       //Get the response payload

  Serial.println(httpCode);                    //Print HTTP return code
  digitalWrite(13, LOW);

  http.end();                                        //Close connection
}

And this is the actual string that gets posted. Copied from the Serial monitor :

VOLRA_TR,2019-07-10,21:57:53,POWER ON,TESTING,ABCD-1234,18,51,48

Am I making a mistake in the content type description or some other mistake ?

Have you checked your HTTP endpoint with another HTTP client other than your microcontroller? What were the results? What did your HTTP request look like?

Try making a GET request from a web browser or try using an HTTP REST client. I use Advanced REST Client.

Maybe try adding the Content-Length header.