shell 模拟curl
来源:互联网 发布:菜刀三国杀淘宝 编辑:程序博客网 时间:2024/06/04 22:36
首先说明参数
代码
创建curl.sh文件
if [ $# != 1 ]; then echo "The parameters you enter is not correct !"; exit -1;fi#循环读出URL并判断状态码while read linedo{ echo %{http_code} $line isok=`curl -I -o /dev/null -s -w %{http_code} $line` if [ "$isok" = "200" ]; then echo $line "OK" else echo $line "no" fi}done < $1echo "执行结束"
文件test.txt
http://www.baidu.comhttp://www.qiniu.com
执行
curl.sh text.txt
参数说明 curl
[ # != 1 ]#表示传入的参数格式
curl -I -o /dev/null -s -w %{http_code} $line
例子
curl -i -X POST "http://fusion.qiniuapi.com/refresh" -H 'Content-Type: application/json' -H 'Authorization: QBox vI2xPIjOoh7udcRw4GdYNvf3o_gKsCx9wdZaC9u-:0KPRVoBiHR2c9K-t9bBr5DVDuUU=' -d '{"urls":["http://7xr0n9.com1.z0.glb.clouddn.com/3.txt.zip"]}'#响应Host: fusion.qiniuapi.comUser-Agent: curl/7.43.0Accept: */*Content-Type: application/jsonAuthorization: QBox vI2xPIjOoh7udcRw4GdYNvf3o_gKsCx9wdZaC9u-:0KPRVoBiHR2c9K-t9bBr5DVDuUU=Content-Length: 60{"urls":["http://7xr0n9.com1.z0.glb.clouddn.com/3.txt.zip"]}
循环语句whlie
0 0
- shell 模拟curl
- Shell 编程用CURL 模拟POST 上传文件 解决417 Expectation
- CURL模拟访问网页
- curl模拟登陆
- curl模拟提交
- CURL 模拟登录
- php curl模拟登陆
- CURL 模拟提交
- PHP Curl模拟
- c++ curl模拟登陆
- CURL模拟cookie登录
- c++ curl模拟登陆
- CURL 模拟文件上传
- curl模拟登入
- PHP - CURL 模拟请求
- c++ curl模拟登陆
- c++ curl模拟登陆
- curl模拟登录
- oracle11g创建表
- Hibenate异常汇总:java.lang.NoClassDefFoundError: org/jboss/
- Android MTK 设置默认启动 Launcher
- 日语单词记忆法
- 版本更新
- shell 模拟curl
- java多线程--“锁”总览
- hdu 2112 HDU Today-Dijkstra
- 深入解析Java注释
- Mac OS使用NTFS格式移动硬盘
- 如何修改android5.1 多帧PNG图片
- 让Scrapy的Spider更通用
- 和 后台联调接口
- 树莓派3安装Node.js