第二节 telnet模拟get和post方法

一.模拟get方法

1.window下

cmd –>telnet 主机地址 80

2.linux下

telnet 主机地址 80

3.按下快捷键:Ctrl+’ ] ‘再按下回车

4.发送请求报文

GET /http/demo1.php HTTP/1.1 
Host:localhost  
空行 
回车

5.回复

HTTP/1.1 200 OK
Date: Thu, 08 Dec 2016 03:37:44 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 5
Content-Type: text/html; charset=UTF-8
空行
demo1

6.解析

GET(请求方法) /http/demo1.php(请求的URL) HTTP/1.1(http协议版本)-->请求行
Host:localhost(请求首部)
(空行)
HTTP/1.1 200(相应结果状态码) OK(状态描述)
Date: Thu, 08 Dec 2016 03:37:44 GMT
Server: Apache/2.4.18 (Ubuntu)(服务器信息)
Content-Length: 5(回复内容一共5字节)
Content-Type: text/html; charset=UTF-8(格式,字符)

demo1(回复内容)

2.post方法

发送

POST /http/demo1.php HTTP/1.1
HOST:localhost
Content-type:application/x-www-form-urlencoded
content-length:20
空行
act=query&name=ghost

回复

HTTP/1.1 200 OK
Date: Thu, 08 Dec 2016 03:54:01 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 11
Content-Type: text/html; charset=UTF-8
空行
query
ghost
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值