shell 发送Post请求,并获取状态码
时间:2017-10-11 15:35:01
收藏:0
阅读:1320
#!/bin/bash aa=$1 result=$(curl -H "Content-type: application/json" -X POST -o /dev/null -s -w %{http_code} -d ‘[{"aa":"‘${aa}‘","bb":"0","cc":"0"}]‘ URL) echo $result
-o /dev/null 屏蔽原有输出信息
-s silent
-w %{http_code} 控制额外输出
评论(0)