curl 模拟 post 访问

curl post 表单

curl -d "param1=value1&param2=value2" -X POST http://localhost
curl -d "param1=value1&param2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost
curl -d "@data.txt" -X POST http://localhost

cat data.txt
param1=value1&param2=value2

curl post json

curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost
curl -d "@data.json" -X POST http://localhost

cat data.json
{
  "key1":"value1",
  "key2":"value2"
}