You are on page 1of 1

cURL cheat sheet Cheat Sheet

by ankushagarwal11 via cheatography.com/18501/cs/1776/

Follow Redirects POST Data Send Header

-L -d <@ filename> -H <header>

-d <data>
Cookies User Agent
Adding an @ reads the data from file.
-b cookiejar Send Cookies using cookiejar -A 'User-Agent-Name'

-c cookiejar Store Cookies in cookiejar HTTP Method


Show Response Header
-b 'n1=v1; n2=v2' -X <Method>
Send raw cookies using -b -i
Specify method to use : POST, HEAD, PUT,
GET, DELETE Prints response headers along with response
Send Binary Data content.

--data-binary @<filename> Output to file


HEAD Request
Does not process the file before sending. -d -o <filename>
sends it in ASCII. -I

Write to file Sends a HEAD request. Only response


Insecure SSL headers are printed.
-O
-k / --insecure
Writes output to file instead of stdout
Verbose output
By default all insecure requests fail. With -k,
insecure requests do not fail. Max operation time -v

Useful to inspect headers


-m <seconds>
Authentication > means data sent by curl
< means data received by curl
-u <username:password> Connect Timeout

--connect-timeout <seconds> Silent mode


Proxy
Specify maximum time allowed to connect to -s
-x <proxy>
remote server
Example : Does not output progress

-x 'http://proxy:2080' Write Out


Show Error
-w <format>
Compression -S
Defines what to display on stdout after a
--compression When used with -s, this shows an error when it
completed and successful operation.
fails.
Curl accepts compression encoding formats : curl -s -w '%{remote_ip} %{time_total} %
gzip, deflate {http_code} \n' -o /dev/null http://ankush.io
Exit Codes

6 Can't resolve host

7 Couldn't connect to host

28 Operation timeout

55 Failed to send data

56 Failed to receive data

By ankushagarwal11 Published 28th February, 2014. Sponsored by Readability-Score.com


Last updated 2nd June, 2014. Measure your website readability!
Page 1 of 1. https://readability-score.com

cheatography.com/ankushagarwal11/