POST JSON content using AT+CIPSEND command

yanisme
Posts: 2
Joined: Thu Jul 29, 2021 12:42 pm

POST JSON content using AT+CIPSEND command

Postby yanisme » Thu Jul 29, 2021 12:51 pm

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

yanisme
Posts: 2
Joined: Thu Jul 29, 2021 12:42 pm

Re: POST JSON content using AT+CIPSEND command

Postby yanisme » Fri Jul 30, 2021 12:10 pm

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}

ESP_Alson
Posts: 106
Joined: Mon Mar 22, 2021 3:37 am

Re: POST JSON content using AT+CIPSEND command

Postby ESP_Alson » Tue Sep 07, 2021 1:18 pm

\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 24 guests