curl

Examples

curl -I <url>

... display header information



curl --data-urlencode "name=This is a test" <url>

... sends a POST request



curl -H "Content-Type: application/json" --request POST -d '{"username": "xyz", "password": "xyz"}' <url>

... sends a JSON encoded POST request



curl -H "Content-Type: application/json" --request POST -d @body.json <url>

... sends a JSON encoded POST request from body.json



curl --basic -u uname -F "ufile=@myfile.zip" <url>

... sends a POST request with a form containing myfile.zip assigned to the field ufile, while authenticating using Basic auth and username uname (curl will prompt for password)



Argument description

  • --cacert <file> - tells curl to use the specified certificate file to verify the peer

  • --capath <dir> - tells curl to use the specified certificate directory to verify the peer. Multiple paths can be provided by separating them with ":" (e.g. "path1:path2:path3"). The certificates must be in PEM format, and if curl is built against OpenSSL, the directory must have been processed using the c_rehash utility supplied with OpenSSL

  • --cert-type <type> - tells curl what type the provided client certificate is using. PEM, DER, ENG and P12 are recognized types

  • --dns-servers <IP1,IP2...> - allows us to list DNS servers curl should use instead of the system default

  • -k --insecure - makes curl skip the verification step and proceed without checking

  • -I --head - fetches the headers only

  • -s --silent - don't show progress meter or error messages

2026-04-11 10:44:59

minicms - © 2020-2026 Simeon Simeonov