curl: use long arguments (#5872)

This commit is contained in:
Nicolas Kosinski
2021-05-04 11:37:07 +02:00
committed by GitHub
parent d02172f9ef
commit 69f02b6510
7 changed files with 54 additions and 54 deletions

View File

@@ -6,31 +6,31 @@
- 将指定 URL 的内容下载到文件:
`curl {{http://example.com}} -o {{文件名}}`
`curl {{http://example.com}} --output {{文件名}}`
- 将文件从 URL 保存到由 URL 指示的文件名中:
`curl -O {{http://example.com/filename}}`
`curl --remote-name {{http://example.com/filename}}`
- 下载文件,跟随 [L] 重定向,并且自动 [C] 续传(恢复)前序文件传输:
- 下载文件,跟随 重定向,并且自动 续传(恢复)前序文件传输:
`curl -O -L -C - {{http://example.com/filename}}`
`curl --remote-name --location --continue-at - {{http://example.com/filename}}`
- Send form-encoded data (POST request of type `application/x-www-form-urlencoded`):
`curl -d {{'name=bob'}} {{http://example.com/form}}`
`curl --data {{'name=bob'}} {{http://example.com/form}}`
- 发送带有额外请求头,使用自定义请求方法的请求:
`curl -H {{'X-My-Header: 123'}} -X {{PUT}} {{http://example.com}}`
`curl --header {{'X-My-Header: 123'}} --request {{PUT}} {{http://example.com}}`
- 发送 JSON 格式的数据,并附加正确的 `Content-Type` 请求头:
`curl -d {{'{"name":"bob"}'}} -H {{'Content-Type: application/json'}} {{http://example.com/users/1234}}`
`curl --data {{'{"name":"bob"}'}} --header {{'Content-Type: application/json'}} {{http://example.com/users/1234}}`
- 使用用户名和密码,授权访问服务器:
`curl -u myusername:mypassword {{http://example.com}}`
`curl --user myusername:mypassword {{http://example.com}}`
- 为指定资源使用客户端证书和密钥,并且跳过证书验证: