linux - Netcat HTTP 发布

标签 linux post netcat

在 linux 中使用 netcat 时,我可以从命令行执行 get fine。

nc google.com 80
GET / HTTP/1.1
Host:google.com

有人可以告诉我如何发帖吗?我试过没有运气。我还尝试使用\r\n 或换行的不同组合。我可以让它在 perl 和 c 中工作。

nc google.com 80
POST /test.php HTTP/1.1
Host:whatever.com
Content-Type:text/html
Content-Length:10

text=hello

header 显示它成功但没有返回任何内容? 请帮忙

最佳答案

我能够通过使用 wireshark 进行故障排除来使其正常工作。

我需要添加一个内容类型

这行得通


POST/test.php HTTP/1.1
主机:127.0.0.1
内容类型:应用程序/x-www-form-urlencoded
内容长度:9

txt=99999



-----

PHP

关于linux - Netcat HTTP 发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4929041/

相关文章:

c++ - strftime() 在 Raspberry Pi (Raspbian) 上失败

变量重新分配中的 C++11 内存释放

php - 重定向输出时无法终止子进程

linux - 将进程标准输入和标准输出重定向到 netcat

c - (C/Linux) 通过 netcat 使用 bin/sh shell 时出现问题 - printfs 直到程序结束才出现在屏幕上

linux - 如何重定向已运行进程的输出

javascript - 没有 jQuery 的 AJAX 不会将 POST 数据发送到 PHP 文件

post - RestTemplate 将图像上传为 MultipartFile,内容类型为 image/jpg

c# - 使用 Flurl 发布 `multipart/form-data`

linux - 从管道转发数据