1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-10-31 04:17:55 +01:00
tldr/pages/common/curl.md

29 lines
599 B
Markdown
Raw Normal View History

2013-12-08 09:56:16 +01:00
# curl
> Transfers data from or to a server
> Supports most protocols including HTTP, FTP, POP
2013-12-08 09:56:16 +01:00
- Download a URL to a file
`curl "{{URL}}" -o filename`
- send form-encoded data
2013-12-08 09:56:16 +01:00
`curl --data {{name=bob}} {{http://localhost/form}}`
2013-12-08 09:56:16 +01:00
- send JSON data
2013-12-08 09:56:16 +01:00
`curl -X POST -H "Content-Type: application/json" -d {{'{"name":"bob"}'}} {{http://localhost/login}}`
2013-12-08 09:56:16 +01:00
- specify an HTTP method
2013-12-08 09:56:16 +01:00
`curl -X {{DELETE}} {{http://localhost/item/123}}`
2013-12-08 09:56:16 +01:00
- head request
2013-12-08 09:56:16 +01:00
`curl --head {{http://localhost}}`
2014-03-11 16:01:45 +01:00
- pass a user name and password for server authentication
`curl -u myusername:mypassword {{http://localhost}}`