常用:curl target.com
若只想查看请求头:curl -I target.com
使用 GET 携带参数:
- 通常可以直接使用 curl "target.com?a=example"
- 也可以使用 curl -G target.com -d "a=example" -d "b=example"
使用 POST 发送:
- 使用curl -X POST target.com -d "a=example"
- 默认使用 Content-Type: application/x-www-form-urlencoded
POST 也可以使用 json:
- curl target.com -H "Content-Type:application/json" -d '{"name":"Mikasu","age":16}'
常见 HTTP 方法:
- GET 获取数据
- POST 创建/提交数据
- PUT 整体修改
- PATCH 部分修改
- DELETE 删除
常见 Header:
- Content-Type
- Authorization
- User-Agent
- Accept
- Cookie
- Referer
- Origin
- Host
使用 Cookie: curl target.com -b "session=abc123"
保存 Cookie: curl target.com -c cookie.txt
查看详细过程:curl target.com -v
形如:
> xxx
> xxx
>
< xxx
< 表示接收到的,> 表示发送出去的
跟随重定向:curl target.com -L
使用代理:curl target.com -X http://127.0.0.1:7890
// 还没有评论