我们将演示用WizFi250通过HTTP(端口80)和HTTPS(端口 443)连接Google网页服务器。
(AP Association)
AT+WLEAVE
[OK]
AT+WSET=0,Wiznet_Kaizen
[OK]
AT+WSEC=0,OPEN
[OK]
AT+WNET=1
[OK]
AT+WJOIN
Joining : Wiznet_Kaizen
Successfully joined : Wiznet_Kaizen
[Link-Up Event]
IP Addr: 192.168.15.10
Gateway: 192.168.15.1
[OK]
(这是用来简易分析数据的。如果你想要手动分析头部数据,可以省略这步)
AT+SFORM=000000000
[OK]
(找到google.com的IP地址)
AT+FDNS=google.com,3000
74.125.128.102
[OK]
(通过HTTP(80)连接google网页服务器)
AT+SCON=O,TCN,74.125.128.102,80,0,0
[CONNECT 0] [OK]
(发送网页请求)
AT+SSEND=0,,,18
[0,,,18]
GET / HTTP/1.1\r\n
[OK]
(现在,你可以通过HTTP接收来自google网页服务器的数据,如下)
HTTP/1.1 302 Found
Location: http://www.google.co.kr/?gws_rd=cr&ei=pIz0UvbYBqmZiQf2zIDgCA
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Set-Cookie: PREF=ID=55cbe1a26a10a4a4:FF=0:TM=1391758500:LM=1391758500:S=V39C5p8-28xe7gVT; expires=Sun, 07-Feb-2016 07:35:00 GMT; path=/; domain=.google.com
Set-Cookie: NID=67=eAwBBej-W68bRryLLG7O86lG5BkNJzD5GpFZxbUnkHmHs6DyaeocsgLh4yd8mYc5pzyQJxTdC4f7GfqSrbC6orrtgErxRRSC0hxloj6B53eKbRYzWeIv5PGF9UT97v2c; expires=Sat, 09-Aug-2014 07:35:00 GMT; path=/; domain=.google.com; HttpOnly
………………………………
(断开与google网页服务器的连接)
AT+SMGMT=ALL
[DISCONNECT 0] [OK]
如下图片是如上HTTP示例的Wireshark抓包。
(到这步,你可以参考< Get HTTP Example >)
(通过HTTPS(443)连接google网页服务器)
AT+SCON=O,TCS,74.125.128.102,443,0,0
[CONNECT 0] [OK]
(发送网页请求)
AT+SSEND=0,,,18
[0,,,18]
GET / HTTP/1.1\r\n\r\n
[OK]
(现在,你可以通过HTTPS从google网页服务器获得数据,如下)
HTTP/1.1 302 Found
Location: http://www.google.co.kr/?gws_rd=cr&ei=pIz0UvbYBqmZiQf2zIDgCA
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Set-Cookie: PREF=ID=55cbe1a26a10a4a4:FF=0:TM=1391758500:LM=1391758500:S=V39C5p8-28xe7gVT;
………………………………
(断开与google网页服务器的连接)
AT+SMGMT=ALL
[DISCONNECT 0] [OK]
如下图片是上面HTTPS示例的Wireshark抓包。
文章评论(0条评论)
登录后参与讨论