进阶的 curl 用法
微信公众号
·
2020-05-14
·
via 陈少文的网站
Please enable Javascript to view the contents
1. Restful 请求
1
| curl -X POST --data 'keyword=value' http://domain.com/mypath/
|
-X 后面还可以是 DELETE PUT 等。
2. 添加头部
1
| curl -H 'Content-Type:application/json' -H 'Authorization: bearer MyToken' http://domain.com/mypath/
|
3. Basic 验证访问
1
| curl -u username:password http://domain.com/mypath/
|
4. 下载并执行
1
| curl -sSL http://domain.com/my.sh | bash
|
5. 忽略证书校验
1
| curl -k https://domain.com/mypath/
|
6. 设置代理
1
| curl -x socks5://proxyuser:proxypassword@proxy.domain.com:8001 https://domain.com/mypath/
|
7. 指定 Host 使用 IP 访问
1
| curl -H 'Host: www.domain.com' 1.2.3.4:8000
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。