Skip to content

Instantly share code, notes, and snippets.

@castleberrysam
Last active March 17, 2018 06:45
Show Gist options
  • Save castleberrysam/6e26e3a0c05de14ed709845678e491ba to your computer and use it in GitHub Desktop.
Save castleberrysam/6e26e3a0c05de14ed709845678e491ba to your computer and use it in GitHub Desktop.
Commonly used cURL flags
-o, --output write to file instead of stdout
-s, --silent silent mode, no progress meter or error messages on stdout
-S, --show-error still print error messages in silent mode
-i, --include include the response header in the output
-I, --head output response header only
-O, --remote-name give output file the same name as the remote file
-A, --user-agent user agent string, use single quotes
-e, --referer send given URL as referer
-u, --user send given <username>:<password> when making the request
-H, --header send extra header fields in request, format "Header-Name: value"
-b, --cookie send cookie, format "NAME1=VALUE1; NAME2=VALUE2; ...", also can specify filename to use
-c, --cookie-jar file to write stored cookies to, also can use - for stdout
-d, --data send text data in a POST request, use @file for a filename or - for stdin
--data-binary send binary data instead of text
-G, --get send data using GET request instead of POST
-F, --form send form data using POST, format "NAME1=VALUE1; NAME2=VALUE2; ...", can use @file for file
upload or <file to upload file contents, - for stdin, "type=sometype" to specify content
type, "filename=somename" to change the name of the uploaded file in POST
-T, --upload-file upload file with PUT request, use - for stdin
-X, --request use custom request method (GET, HEAD, POST, PUT, DELETE, ...)
--connect-timeout timeout when attempting to connect in seconds
-m, --max-time timeout for entire operation in seconds
-L, --location follow location (code 3XX) redirects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment