我只是在作閱讀美化。 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
|