如何从 linux 命令行测试 Http Post 查询

How can I test a Http Post query from linux command line

我正在使用 wget 测试对我的服务器的获取请求

即我创建了从命令行获取参数并将其用作 wget 请求的一部分的脚本

 #!/bin/bash
 wget  http://servername?querystring

但我需要更改服务器,使其只接受 http post 而不是 http get。很好,但我不知道如何轻松测试它,我怎样才能发送带有参数的 post 而不是 get

我使用的是 linux

的版本

你必须使用 --post-data :

wget --post-data 'user=foo&password=bar' http://server.com/auth.php

更多的选项,你可以看看 man here 或 with man wget