Команда curl: опции, ключи и примеры использования


Transfers data from or to a server. Supports most protocols, including HTTP, FTP, and POP3.

  • Download the contents of an URL to a file:

curl {{}} -o {{filename}}

  • Download a file, saving the output under the filename indicated by the URL:

curl -O {{}}

  • Download a file, following [L]ocation redirects, and automatically [C]ontinuing (resuming) a previous file transfer:

curl -O -L -C - {{}}

  • Send form-encoded data (POST request of type application/x-www-form-urlencoded):

curl -d {{'name=bob'}} {{}}

  • Send a request with an extra header, using a custom HTTP method:

curl -H {{'X-My-Header: 123'}} -X {{PUT}} {{}}

  • Send data in JSON format, specifying the appropriate content-type header:

curl -d {{'{"name":"bob"}'}} -H {{'Content-Type: application/json'}} {{}}

  • Pass a user name and password for server authentication:

curl -u myusername:mypassword {{}}

  • Pass client certificate and key for a resource, skipping certificate validation:

curl --cert {{client.pem}} --key {{key.pem}} --insecure {{}}

Также может быть вам интересно:
Фото ctest


Фото cut


Интересное на «Цифре»