Telnet发送get/post请求
-
连接到HTTP服务器
telnet www.baidu.com 80
-
Ctrl + ]
-
发送请求
GET /index.html HTTP/1.1 Host: www.baidu.com
# 发送post请求 POST /test/firstTest HTTP/1.1 HOST:127.0.0.1 Content-Type:application/x-www-form-urlencoded Content-Length:10
-
连续按两次 Enter 键发送请求
HTTP/1.1 200 OK Date: Mon, 18 Jun 2021 10:00:00 GMT Content-Type: text/html Content-Length: 12345<html> <head> <title>百度一下,你就知道</title> ... </html>
-
退出telnet
Ctrl + ]
输入quit
步骤 | 操作 | 说明 |
---|---|---|
步骤1 | 打开CMD | 使用Win + R打开运行对话框,输入cmd并回车 |
步骤2 | 连接到HTTP服务器 | 在CMD中执行 telnet www.baidu.com 80 |
步骤3 | 退出Telnet命令模式 | 按下 Ctrl + ] 退出命令模式 |
步骤4 | 进入输入模式 | 按下 Enter 键进入输入模式 |
步骤5 | 发送HTTP请求 | 输入并发送HTTP请求内容 |
步骤6 | 查看结果 | 连续按两次 Enter 键发送请求并查看响应 |