Page 1 of 1

POST JSON content using AT+CIPSEND command

Posted: Thu Jul 29, 2021 12:51 pm
by yanisme
I need correct syntax to use AT+CIPSEND command in order to send HTTP POST request.

First I send:
AT+CIPSTART="TCP","test.myserver.com",80

CONNECT
OK

Then:
AT+CIPSEND=130

When I get the prompt I send something like:
> POST /test_json.php HTTP/1.1\r\nHost: test.myserver.com\r\nContent-Type: application/json\r\nContent-length: 11\r\n\r\n{"test": 3}

SEND OK
CLOSED

I get a SEND OK response from the ESP32 but the server does not received any HTTP POST request and the connection is CLOSED just after

Re: POST JSON content using AT+CIPSEND command

Posted: Fri Jul 30, 2021 12:10 pm
by yanisme
resolved: shall not put "\r\n" characters into the string but like this:

> POST /test_json.php HTTP/1.1
Host: test.myserver.com
Content-Type: application/json
Content-length: 11

{"test": 3}

Re: POST JSON content using AT+CIPSEND command

Posted: Tue Sep 07, 2021 1:18 pm
by ESP_Alson
\r and \n are non-displayable character. So it can not be directly input in the transmission data, it must be realized by the enter key.