设置user-agent
curl -A "Chrome" http://www.baidiu.com
设置指定方法请求
curl -X POST http://httpbin.org/post
只返回请求头的信息
curl -I www.baidu.com
以post方法请求,并发送相应的参数
curl -d arg1=1 -d arg2=2 -d arg3=3 http://httpbin.org/post
curl -d "arg1=1&arg2=2&arg3=3" http://httpbin.org/post
curl -d @filename http://httpbin.org/post
下载文件
curl -O http://httpbin.org/image/jpeg
下载文件并重命名文件
curl -o filename http://httpbin.org/image/jpeg
跟随重定向请求
curl -L http://baidu.com
允许发生ssl不安全的请求
curl -k https://www.12306.cn
设置头信息
curl -o filename -H "accept:image/png" http://httpbin.org/image/jpeg
设置cookies
curl -b arg1=1 http://httpbin.org/post
查询公网IP
$ curl ifconfig.me
49.80.161.165