HTTP/HTTPS 통신연습 → POST Request
The following commands show how to send an HTTP POST request to the server, and how to read HTTP response.
1. HTTP-POST 명령시퀀스
NO | Command | Response | 설명 |
1 | PDP Context 설정 | ||
2 | AT+HTTPINIT | OK |
(1) PDP Context 활성화 (2) HTTP Service 시작 |
3 |
AT+HTTPPARA=”URL”, “http://httpbin.org/post” |
OK | Set an URL to be accessed for HTTP |
– |
AT+HTTPPARA=”URL”, “https://httpbin.org/post” |
OK | Set an URL to be accessed for HTTPS |
4.1 | AT+HTTPDATA=11,1000 | DOWNLOAD | |
4.2 | helloworld! | OK | Post할 11자리 데이터를 입력한다. |
5 | AT+HTTPACTION=1 |
OK +HTTPACTION: 1,200,378 |
Send HTTP POST request |
6 | AT+HTTPHEAD | +HTTPHEAD: DATA,225 HTTP/1.1 200 OK Date: Sat, 27 Nov 2021 08:37:07 GMT Content-Type: application/json Content-Length: 380 Connection: close Server: gunicorn/19.9.0 Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: trueOK |
|
7 | AT+HTTPREAD? |
+HTTPREAD: LEN,378 OK |
|
8 | AT+HTTPREAD=0,378 |
OK +HTTPREAD: DATA,378 +HTTPREAD: 0 |
|
9 | AT+HTTPTERM | OK | Stop HTTP Service |