-
Notifications
You must be signed in to change notification settings - Fork 0
Cheatsheet CURL
Agustí Sánchez edited this page Jun 17, 2015
·
6 revisions
- Verbose:
-v
- Header:
-H "Accept-Language: ca"
- Follow redirect:
-L
- Ignore SSL stuff:
-k
- Output to file:
-o
- Include response headers in output file (used with
-o
):-i
- Proxy:
--proxy http://user:password@host:port
Example. Verbose with language header and not following redirects:
curl -v -H "Accept-Language: ca" -XGET "http://mcunix24d6:9100/"
Example. Verbose with language header, following redirects and ignoring SSL validation:
curl -v -L -k -H "Accept-Language: ca" -XGET "https://mcunix24d6:9443/"
- Inline JSON payload:
-d
:
curl -XPOST 'http://localhost:8080/myapp/endpoint' -H "Content-Type: application/json" -d '{
"aaa": {
"bbb": "circle",
"ccc": 333.333
},
"ddd": "cccc"
}'
-b cookies.txt
The cookies file format apparently consists of a line per cookie and each line consists of the following seven tab-delimited fields:
- domain - The domain that created AND that can read the variable.
- flag - A TRUE/FALSE value indicating if all machines within a given domain can access the variable. This value is set automatically by the browser, depending on the value you set for domain.
- path - The path within the domain that the variable is valid for.
- secure - A TRUE/FALSE value indicating if a secure connection with the domain is needed to access the variable.
- expiration - The UNIX time that the variable will expire on. UNIX time is defined as the number of seconds since Jan 1, 1970 00:00:00 GMT.
- name - The name of the variable.
- value - The value of the variable. From http://www.cookiecentral.com/faq/#3.5
[http://overloaded.io/timing-http-requests-curl]
[http://stackoverflow.com/questions/18215389/how-do-i-measure-request-and-response-times-at-once-using-curl]