我只是在作阅读美化。 curl可以模仿浏览器,可以当下载器,当你只是在处理一些shell工作时、测试,要图形界面干嘛?或者,要一个下载器干嘛。
基本用法(配合sed/awk/grep)
1
|
$curl http:
//bpsky
.net
|
下载保存
1
|
$curl http:
//bpsky
.net > index.html
|
1
|
$curl -o index.html http:
//bpsky
.net
|
1
|
$curl -O http:
//bpsky
.net
/target
.
tar
.gz
|
通过代理
1
|
$curl -x 123.45 . 67.89 : 1080 -o page.html http:
//bpsky
.net
|
保存cookie
1
|
$curl -x 123.45 . 67.89 : 1080 -o page1.html -D cookie0001.txt http:
//bpsky
.net
|
使用cookie
1
|
$curl -x 123.45 . 67.89 : 1080 -o page1.html -D cookie0002.txt -b cookie0001.txt http:
//bpsky
.net
|
模仿浏览器
1
|
$curl -A
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
-x 123.45 . 67.89 : 1080 -o page.html -D cookie0001.txt http:
//bpsky
.net
|
伪造referer
1
|
$curl -A
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
-x 123.45 . 67.89 : 1080 -e
"mail.yahoo.com"
-o page.html -D cookie0001.txt http:
//bpsky
.net
|
循环下载
1
|
$curl -O http:
//cgi2
.tky.3web.
ne
.jp/~zzh
/screen
[1-10].JPG
|
循环(匹配)下载
1
|
$curl -O http:
//cgi2
.tky.3web.
ne
.jp/~{zzh,nick}/[001-201].JPG
# >like zzh/001.JPG
|
循环(引用)下载
1
|
$curl -o
#2_#1.jpg http://cgi2.tky.3web.ne.jp/~{zzh,nick}/[001-201].JPG # like >001_zzh.jpg
|
断点续传
1
|
$curl -c -O http:
//cgi2
.tky.3wb.
ne
.jp/~zzh
/screen1
.JPG
|
分块下载
1
2
3
4
5
6
|
$curl -r 0 - 10240 -o
"zhao.part1"
http:
//cgi2
.tky.3web.
ne
.jp/~zzh
/zhao1
.mp3 &\
$curl -r 10241 - 20480 -o
"zhao.part1"
http:
//cgi2
.tky.3web.
ne
.jp/~zzh
/zhao1
.mp3 &\
$curl -r 20481 - 40960 -o
"zhao.part1"
http:
//cgi2
.tky.3web.
ne
.jp/~zzh
/zhao1
.mp3 &\
$curl -r 40961 - -o
"zhao.part1"
http:
//cgi2
.tky.3web.
ne
.jp/~zzh
/zhao1
.mp3
...
$
cat
zhao.part* > zhao.mp3
|
GET 上传
1
|
$curl http:
//www
.yahoo.com
/login
.cgi?user=nickwolfe&password=12345
|
POST 上传
1
|
$curl -d
"user=nickwolfe&password=12345"
http:
//www
.yahoo.com
/login
.cgi
|
POST 文件上传
1
|
$curl -F upload= $localfile -F $btn_name=$btn_value http:
//cgi2
.tky.3web.
ne
.jp/~zzh
/up_file
.cgi
|