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
POST JSON content using AT+CIPSEND command
Re: POST JSON content using AT+CIPSEND command
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}
> 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
\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.
Who is online
Users browsing this forum: No registered users and 55 guests