AT+CIPSEND multiple POST request body [ESP01][ESP8266]

Hardware:
Arduino Uno >[SoftwareSerial]> ESP01

I am programing Arduino to send AT command to a web hosting server.

What will work:

AT+CIPSEND=92

> POST /echo.php HTTP/1.0
Host: mywebsite.com
Content-Length: 20

this is POST payload

Server respond:

+IPD,854:HTTP/1.1 200 OK
Date: Fri, 30 Mar 2018 20:41:13 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Server: awex
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Request-ID: 446bb0a824a3ca74638c65cc641cee1d


<!DOCTYPE html>
<html>
<body>

this is POST payload
</body>
</html>

Note:

  • newline above is \r\n
  • I put the whole HTTP request in single String variable

Problem:
Now, I want to send “body” of the post request separately. Meaning that there will be two AT+CIPSEND. This is to save more RAM space and I can put the “body” String in other non-volatile memory space. I plan to send multiple binary file too . Which will be:

AT+CIPSEND=70

> POST /echo.php HTTP/1.0
Host: mywebsite.com
Content-Length: 20

AT+CIPSEND=22

>this is POST payload

Sever side “echo.php” will echo back the HTTP content if it received the post request. However, the server doesen’t like this and do not echo what I’ve sent:

<?php
$entityBody = file_get_contents('php://input');
echo($entityBody);
?>

I have a feeling that the problem might have to do with my HTTP formatting. Can someone help?