curl使用方法


curl使用方法详解

FTP上传

1
curl -T dodo1.JPG -u 用户名:密码 ftp://www.linux.com/img/

FTP下载

1
2
3
curl -O -u 用户名:密码 ftp://www.linux.com/dodo1.JPG

curl -O ftp://用户名:密码@www.linux.com/dodo1.JPG

保存网页

1
curl http://www.linux.com >> linux.html

获取网址头信息

1
curl  -s  --head  www.sina.com

GET请求

1
2
3
curl http://mywebsite.com/index.php?a=1\&b=2\&c=3 -v

curl -s "http://mywebsite.com/index.php?a=1&b=2&c=3"

POST请求

1
2
curl localhost:9999/api/daizhige/article -X POST -H "Content-Type:application/json" -d "title=comewords&content=articleContent"
说明:-X PUT 和 -X DELETE 来指定另外的请求方法。-d 参数,来传送我们的参数 -H 参数来申明请求的 header

POST上传文件

1
2
curl localhost:8000/api/v1/upimg -F "file=@/Users/fungleo/Downloads/401.png" -H "token: 222" -v
说明:

参考一

参考二