Click to know: Wireless module WizFi210
1. Introduction to HTTP and HTTPS
1.1 HTTP Introduction
HTTP is the Hypertext Transfer Protocol (Hyper Text Transfer Protocol), the client (User Agent) to specify a port (default of 80) from a Web browser or crawler to a server (Web site) to initiate an HTTP request (typically get, POST) in the form of a URL (Uniform Resource Locator, or URL) When the server supervisor hears this request, it responds to the body of a status line + response message, thus forming a complete HTTP request-response process, which is a process of transparent data transmission over a TCP connection.
1.2 HTTPS Introduction
HTTPS full name Hyper Text Transfer Protocol overSecure socket Layer, which is SSL (Secure socket Laye R) encrypted HTTP, simply the security upgrade version of HTTP. The system of HTTPS is roughly the same as HTTP, and the difference is that data encryption and authentication are achieved by adding an SSL layer between the HTTP and TCP tiers. Using HTTPS requires a CA certificate (typically paid), with 443 ports and is now widely used for secure, sensitive communications on www.
2. WizFi210 steps to implement HTTP requests
(1) Set WizFi210 to connect to an AP that can log on to the remote HTTP server and enter command mode.
at this time WizFi210 need to run in station mode, that is, at+wm=0. There can be two ways to connect to the AP after the way into the command mode, one is at+wa=ssid directly into the command mode, one is automatic connection into the data transmission mode after typing "+ + +" into the command mode.
(2) Configure HTTP Client for WizFi210: at+httpconf=<Param>,<Value>.
Parameters |
Meaning |
Example of parameter values |
2 |
Authorization Certificate for HTTP Authorization |
Authorization:basic qwxhzgrpbjpvcgvuihnlc2ftzq== |
3 |
Indicates whether a persistent connection is required. (HTTP 1.1 defaults to persistent connection) |
Connection:close |
4 |
Return content compression encoding type supported by the Web server |
Content-encoding:gzip |
5 |
The length of the response body |
content-length:348 |
6 |
The byte position of this section in the entire return body |
Content-range:bytes 21010-47021/47022 |
7 |
The requested MIME information corresponding to the entity |
content-type:application/x-www-form-urlencoded |
8 |
Date and time the request was sent |
Date:tue, 08:12:31 GMT |
9 |
Date and time when the response expires |
Expires:thu, 16:00:00 GMT |
10 |
Email from the user who made the request |
From: [Email protected] |
11 |
Specify the domain name and port number of the requested server |
Host:www.zcmhi.com |
12 |
If the requested part is modified after the specified time, the request succeeds, and the 304 code is returned without modification |
If-modified-since:sat, Oct 19:43:31 GMT |
13 |
Requested last modified time for resource |
Last-modified:tue, 12:45:26 GMT |
14 |
Used to redirect the receiver to the location of the non-request URL to complete the request or identify the new resource |
Location:http://www.zcmhi.com/archives/94.html |
15 |
Includes implementing a specific instruction that can be applied to any receiver on the response chain |
Pragma:no-cache |
16 |
Request only part of an entity, specify a range |
range:bytes=500-999 |
17 |
The address of the previous page, which is immediately followed by the current request page, |
Referer:http://www.zcmhi.com/archives/71.html |
18 |
Web software Name |
server:apache/1.3.27 (Unix) (Red-hat/linux) |
19 |
File transfer encoding |
Transfer-encoding:chunked |
20 |
The content of the user-agent contains the user information that made the request |
user-agent:mozilla/5.0 (Linux; X11) |
21st |
Indicates the authorization scheme that the client request entity should use |
Www-authenticate:basic |
23 |
Get the Request server address |
http://www.abc.com?id=001 |
Depending on the client and server, the parameters and parameter values need to be different, the user can get the parameter values that need to be set by the Wareshark and other grasping package tool.
(3) WizFi210 establishes a socket HTTP connection as an HTTP client and then connects to the server specified by the host name or IP address (because HTTP is built on top of the TCP connection, So you can use the Grab packet tool Wareshark, etc. to get a TCP connection three handshake data packet), so that: At+httpopen= is the IP address of the HTTP server ,<cid> is the socket number.
(4) Get (GET)/upload (POST) HTTP data on an HTTP connection
Command format: At+httpsend=<cid>,<type>,<timeout>,<page>,<size of content>
Immediately After, enter:<ESC>h<cid><Contents>in timeout time, No carriage return required.
where,<cid> for the previously obtained socket number;<type> as an HTTP request way: 1 for GET, 3 for post;
<timeout> The Wait time to enter HTTP data;< Page> is a page in the URL, the HTTP URL is usually composed of Http: [ok " \r\n ← h0xxxx200 ok\r\n{...} \r\n[disconnect 0] \r\n\r\n[ok] ,http connection is disconnected.
3. WizFi210 HTTP Request Example
The following is an example of GET, post just change the type of httpsend to 3, do not repeat here.
At+wd
[OK]
At+wm=0
[OK]
at+wwpa=12345678
[OK]
At+ndhcp=1
[OK]
At+wa=wiznet
IP SubNet gateway
192.168.1.120: 255.255.255.0: 192.168.1.1
[OK]
AT+HTTPCONF=20, mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
[OK]
at+httpconf=5,150
[OK]
at+httpconf=7,application/x-www-form-urlencoded
[OK]
at+httpconf=11, weibo.com
[OK]
at+httpopen= weibo.com,80,0
ip:180.149.134.1410
[OK]
at+httpsend=0,1,10,/u/2097310012/home?wvr=5,150
[OK]
← h0xxxx200 OK
{...}
[DISCONNECT 0]
[OK]
Thanks for reading!
Welcome to visit:
Wiznet Official website: http://www.iwiznet.co.kr
Wiznet Official micro-blog: http://weibo.com/wiznet2012
Wiznet Public Number: Iwiznet
How do I use the HTTP features of the wireless module WizFi210?