使用shell脚本批量发送curl的POST数据请求
星期五, 2019-10-18 | Author: Lee | JAVA-and-J2EE, linux | 7,490 views
里面写了sleep睡眠,可以移除
写定循环传递参数等,用于自动处理数据比较方便,记录如下,可以根据自己的情况进行调整.
shell脚本如下
#!/bin/bash function curlRequest() { echo ">>>>>>>>>>>>>>"$1 info=`curl -s -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{\"id\":$1,\"processState\":3}" "https://www.pomelolee.com/info" ` echo "<<<<<<<<<<<<<<"$info #info=`curl -s -m 10 --connect-timeout 10 -I $1` #code=`echo $info|grep "HTTP"|awk '{print $2}'` #if [ "$code" == "200" ];then # echo "request succeed,ret code is $code" #else # echo "request fail,ret code is $code" #fi } ids=(29 100 13 8 91 44) for id in ${ids[@]} do curlRequest $id echo $id sleep 2s done |
文章作者: Lee
本文地址: https://www.pomelolee.com/1940.html
除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址
No comments yet.
Leave a comment
Search
相关文章
热门文章
最新文章
文章分类
- ajax (10)
- algorithm-learn (3)
- Android (6)
- as (3)
- computer (85)
- Database (30)
- disucz (4)
- enterprise (1)
- erlang (2)
- flash (5)
- golang (3)
- html5 (18)
- ios (4)
- JAVA-and-J2EE (186)
- linux (143)
- mac (10)
- movie-music (11)
- pagemaker (36)
- php (50)
- spring-boot (2)
- Synology群晖 (2)
- Uncategorized (6)
- unity (1)
- webgame (15)
- wordpress (33)
- work-other (2)
- 低代码 (1)
- 体味生活 (40)
- 前端 (21)
- 大数据 (8)
- 游戏开发 (9)
- 爱上海 (19)
- 读书 (4)
- 软件 (3)