curl命令发起post请求
在linux/mac上发起请求get/post,curl命令不可或缺
curl post
1.curl post xml报文
echo '<?xml version …>'|curl -X POST -H 'Content-type:text/xml' -d @- http://10.x:8081/loginregistration/register
cat 1.xml | curl -X POST -H 'Content-type:text/xml' -d @- http://10.7.2.86:7104/BwzhService/gdyth/httpInvokeServlet
#1.xml 报文文件 @- 读取管道符内容
2.curl post json 报文
curl -H "Content-Type:application/json" -X POST --data '[{"index":["*"],"preference":"1503652289983","ignore_unavailable":"true"},{"sort":[{"timestamp":{"order":"desc"}}],"query":{"must_not":[],"bool":{"must":[{"query_string":{"query":"cluster"}},{"range":{"timestamp":{"gte":"1503667558137","lte":"1503667558137"}}}]}},"from":"0","size":"500","version":"true"}]' http://1.x:18080/
cat 1.json | curl -H "Content-Type:application/json" -X POST -d @- http://10.x:7104/x/y/httpInvokeServlet
curl -H "Content-Type: application/json" -X POST '{"JSON体"}' http://127.0.0.1/