telnet 模拟http请求

来源:互联网 发布:java socket 聊天室 编辑:程序博客网 时间:2024/05/18 00:08

1.cmd 下 telnet 主机地址(本地127.0.0.1) 80
若打不开 在控制面板》程序和功能》打开或关闭Windows》开启telnet

2.按下Ctrl + “]” 在按下回车键

这里写图片描述

3.发送请求报文

再按一次回车

GET(请求方法) /test/test1.php(请求URL) HTTP/1.1(请求协议版本)
Host:localhost(请求首行)
(空行)
响应内容
HTTP/1.1 200(响应结果状态码) OK(状态描述)
Date: Thu, 23 Nov 2017 12:26:04 GMT
Server: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.15
X-Powered-By: PHP/5.6.15
Content-Length: 11
Connection: close
Content-Type: text/html; charset=UTF-8

hello world

POST 方法

POST /test/test1.php HTTP/1.1
HOST:localhost
Content-type:application/x-www-form-urlencoded
content-length:20

act=query&name=ghostHTTP/1.1 200 OK
Date: Thu, 23 Nov 2017 12:40:43 GMT
Server: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP
X-Powered-By: PHP/5.6.15
Content-Length: 11
Content-Type: text/html; charset=UTF-8

query
ghost

原创粉丝点击