HTTP/HTPPS 통신연습-File Post and Read
The following commands show us how to send a file to the HTTP server, and how to read HTTP content as a file.
We have our HTTP GET request in a file getbaidu.txt, and save the file in directory “/data/media” before we execute AT+HTTPPOSTFILE
1. HTTP-FILE POST/READ 명령시퀀스
NO | Command | Response | 설명 |
1 | PDP Context 설정 |
|
|
2 | AT+HTTPINIT | OK |
(1) PDP Context 활성화 (2) HTTP Service 시작 |
3 |
AT+HTTPPARA=”URL”, “http://speedtest.tele2.net” |
OK | HTTP 통신 |
– |
AT+HTTPPARA=”URL”, “https://speedtest.tele2.net” |
HTTPS 통신 | |
– AT+FSLS | +FSLS: SUBDIRECTORIES: usb mifi+FSLS: FILES: readme.txt readtest.dat data_bk_ver.txt dnsmasq.conf readbaidu.dat mobileap_cfg.xml readtest1.dat
OK |
List All items in “F:/” | |
5 | AT+HTTPPOSTFILE=”readme.txt”,0,0 |
OK +HTTPPOSTFILE: 0,400,166 |
|
6 | AT+HTTPHEAD | ‘+HTTPHEAD: DATA,145 HTTP/1.1 400 Bad Request Server: nginx Date: Sun, 05 Dec 2021 07:38:53 GMT Content-Type: text/html Content-Length: 166 Connection: closeOK |
|
7 | AT+HTTPREADFILE=”readtest1.dat” |
OK +HTTPREADFILE: 0 |
|
– AT+FSLS | +FSLS: SUBDIRECTORIES: usb mifi+FSLS: FILES: readme.txt readtest.dat data_bk_ver.txt dnsmasq.conf readbaidu.dat mobileap_cfg.xml readtest1.dat
OK |
||
8 | AT+HTTPTERM | OK | Stop HTTP Service |