11/5/2013 - 3:32 AM

curl 命令

curl 命令

curl 命令

如果你再*nix机器下,运行man curl命令查看具体的使用用法。

curl 简介

curl is a tool to transfer data from or to a server, using one of the supported protocols (http, https, ftp, ftps...). The command is designed to work without user interaction.

curl offers a busload of useful tricks like proxy support, user authentication, ftp upload, http post, ssl connections, cookies, file transfer resum and more.

curl 语法

curl [options] [URL...]

curl 实例

// 查看请求信息
curl -I www.baidu.com

// 批量
curl http://(tieba, fm, zhidao).baidu.com/
curl http://sports.tumblr.com/page/[5-10]

// GET请求
curl 'www.a.com/junk.cgi?name1=value1&name2=value2'

// POST请求
curl -d 'name=value1&password=pass1' www.a.com/junk.cgi

// 上传文件
curl -F upload=@localfilename -F press=OK [URL]

curl http://www.yahoo.com > page.html
curl -o page.html http://www.yahoo.com

curl -O http://cgi2.tky.3web.ne.jp/~zzh/screen[1-10].JPG
curl -o #2_#1.jpg http://cgi2.tky.3web.ne.jp/~{zzh,nick}/[001-201].JPG

curl -u name:password www.secrets.com

curl -U proxyuser:proxypassword http://curl.haxx.se