CURL使用
模拟 multipart/form-data 形式的 form 上传文件
1
curl -F "filename=@/home/test/file.tar.gz" http://localhost/action.php
获取web服务器支持的方法
1
2
3
4-i 显示响应中的http头 还包含报文中的内容
-X 指定请求的http方法
--head 只显示HTTP头的内容
curl -i -X OPTIONS 192.168.1.3提交POST请求
1 | curl -i -X POST -d "username=admin&passwd=12121" http://192.168.1.3/login |
使用cookie
1
curl --cookie "name=admin;xx=xx" http://192.168.1.3/login
设置user-agent
1
curl -A "chrome"
设置来源
1
curl -e "https://www.baidu.com" http://www.google.com
所有设置请求头的要求,都可以用H参数
1
curl -H "accept-language: enus" http://www.google.com
模拟登陆
1
curl -u "admin:passwd" http://192.168.1.3/login

