CURL Cheatsheet

CURL Cheatsheet

Change system wide user agent

Create.curlrcin $HOME directory and add this line

user-agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"

to suppress this file use

curl -q example.com

Include the header response in output

curl -i

Head request

curl -I

get request and header in the response

curl -D

Verbose

curl -v

Follow redirects

curl -L

Save cookies to a file

curl -b cookiesfile <url>

NOTE: cookiesfile is a file in which cookeis are saved

User saved cookies

curl -c cookiesfile <url>

Make POST request

curl -XPOST <url>

Note: change POST to PUT, PATCH or whatever you need except HEAD, use-Ifor HEAD

Make POST request with data

curl --data "param1=value1&param2=value2" <url>

List Input Field

curl website | gunzip | sed -n '/<form/,/<\/form/p' | grep '<input'

List Input Field Uncompressed

curl website | sed -n '/<form/,/<\/form/p' | grep '<input'

Original: Updated: