1. curl html
-s silent -v 详细输出 -L 302 追踪json
-w 自定义输出格式 如 bash
-w %{http_code} curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\ncurl
-x 代理ui
-I 只输出请求header , -i include 请求内容和 headerthis
-A 自定义user-agent编码
curl -A "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"url
-H 自定义header.net
默认请求内容输出到屏幕 , -o 输出重定向, 能够直接请求https翻译
-d POST 请求发送 json 数据, 如
curl -H "Content-type:Application/json" -d '{"hostname": "CNC-WV-b-D40", "result": {"hostname": "hostname", "network": [{"DEVICE": "bond0", "IPADDR": "1.1.1.1"}, {"DEVICE": "bond1", "IPADDR": "10.11.100.32"}], "service_tag": "060580bD40"}}' "url"
https 访问加代理方式 --resolv blog.csdn.net:443:47.95.47.253
curl 组合使用命令
-Lvo /dev/null 访问内容输出到 /dev/null -o 访问结果 输出详情 -v follow 第三方跳转 -L
-s 访问结果silence ,传输速度 不输出,curl 默认显示传输速度
--limit-rate number 限速,能够识别单位,不加单位默认是 比特, B ,不是 b 字节。
wget 参数
-O 下载内容输出位置,默认输出到当前目录,名字为url 的文件名,-O 自定义名字
-S print server response
-q quite
--limit-rate=1K 限速 1KB/s, 和 curl 限速同样,不加单位,默认是B,字节,不是b,比特,命令和curl 区别是 curl 无= wget 跟 =
-O 跟- 表明下载内容输出到 stand output ,同 curl 默认输出,多用于 直接执行下载脚本内容。如 wget -qO - http://url/a.sh |bash
curl 如何访问ipv6 地址:
提示: 将ipv6 地址 放到 [] 里, 其余语法照旧:
如:curl "http://[2409:8c44:2f00:300:8001::239]:80/m.html"
”“ 加不加 无所谓
curl 报错 curl: (3) [globbing] error: bad range specification after pos 9
解决办法: 加 -g :
-g/--globoff
This option switches off the "URL globbing parser". When you set this option, you can specify URLs that contain the letters {}[] without having them being interpreted by curl itself. Note that these letters are not normal legal
URL contents but they should be encoded according to the URI standard.
翻译:
-g/ --globoff 通配符关闭 globbing 通配符
这个选项 是 关闭 “URL 通配符 解析” 。当你设置了此参数,你就能够指定 那些包含 字符 {} 和 [] 的 URL 不用翻译这些字符(即不把这两个字符当通配符对待)。注意 这些字符 并非 正常合法的URL 包含的,但它们 应当被 依据 URI 标准 被 编码。