1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/curl.md

41 lines
854 B
Markdown
Raw Normal View History

2013-12-08 19:56:16 +11:00
# curl
> Transfers data from or to a server.
> Supports most protocols including HTTP, FTP, POP.
2013-12-08 19:56:16 +11:00
- Download a URL to a file:
`curl "{{URL}}" -o {{filename}}`
- Send form-encoded data:
2013-12-08 19:56:16 +11:00
`curl --data {{name=bob}} {{http://localhost/form}}`
2013-12-08 19:56:16 +11:00
- Send JSON data:
2013-12-08 19:56:16 +11:00
`curl -X POST -H "Content-Type: application/json" -d {{'{"name":"bob"}'}} {{http://localhost/login}}`
2013-12-08 19:56:16 +11:00
- Specify an HTTP method:
2013-12-08 19:56:16 +11:00
`curl -X {{DELETE}} {{http://localhost/item/123}}`
2013-12-08 19:56:16 +11:00
- Head request:
2013-12-08 19:56:16 +11:00
2016-01-19 13:13:41 -05:00
`curl -I {{http://localhost}}`
2014-03-11 10:01:45 -05:00
- Include an extra header:
2016-01-12 11:24:22 -08:00
`curl -H "{{X-MyHeader: 123}}" {{http://localhost}}`
2016-01-12 11:24:22 -08:00
- Pass a user name and password for server authentication:
2014-03-11 10:01:45 -05:00
`curl -u myusername:mypassword {{http://localhost}}`
- Retrieve verbose output for a cURL request:
`curl -v {{http://localhost}}`
2016-01-19 13:14:49 -05:00
- Retrieve super verbose output for a cURL request:
2016-01-19 13:17:03 -05:00
2016-01-19 13:14:49 -05:00
`curl -vvv {{http://localhost}}`