Links
- Manpage
-x, --proxy
: Use the specified proxy
-X, --request
: Specifies a custom request method
- --socks4 <host[:port]>
- --socks5 <host[:port]>
- -T, --upload-file <file>
-D, --dump-header <file>
-A, --user-agent <agent string>
: set User-Agent
- Specify the User-Agent string to send to the HTTP server.
- To encode blanks in the string, surround the string with single quote marks.
- This can also be set with the
-H, --header
option.
-H, --header <header>
- Extra header to include in the HTTP request.
- Remove an internal header by giving a replacement without content on the right side of the colon, as in: -H "Host:".
- If you send the custom header with no-value then its header must be terminated with a semicolon, such as -H "X-Custom-Header;" to send "X-Custom-Header:".
- curl will make sure that each header you
add/replace is sent with the proper end-of-line
marker, you should thus not add that as a part
of the header content: do not add newlines or
carriage returns, they will only mess things up
for you.
-e, --referer <URL>
- Send "Referrer Page" URL to the HTTP server.
- When used with
-L, --location
you can append ;auto
to the --referer
URL to
make curl automatically set the previous URL
when it follows a Location:
header. The ;auto
string can be used alone, even if you don't set
an initial --referer
.
~/.curlrc
: Default curl config. Change via -K, --config
- The config file is a text file in which command
line arguments can be written which then will be
used as if they were written on the actual
command line.
- If the first column of a config line is a
'#'
character, the rest of the line will be treated as a comment.
- Only write one option per physical line in the config file.
- Options and their parameters must be specified
on the same config file line, separated by
whitespace, colon, or the equals sign.
- Long option names can optionally be given in the
config file without the initial double dashes
and if so, the colon or equals characters can be
used as separators.
- If the option is specified with one or two
dashes, there can be no colon or equals
character between the option and its
parameter.
- If the parameter is to contain whitespace, the parameter must be enclosed within quotes.
- Within double quotes, the following escape sequences are available: \, \", \t, \n, \r and \v.
- A backslash preceding any other letter is ignored.
Snippets
# -L: Follow redirects
curl -L -O 'http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz'
# Make JSON POST request
curl -H 'content-type:application/json' -d '{"name": "alice"}' http://localhost:8000/hello.hello