Curl Cheat Sheet

Basic curl

curl https://example.com

Display headers and the response body

curl -i https://example.com

Make it verbose

curl -vvv -i https://example.com

Save the output into a file

curl  http://alexrabocse.me -o curl-test.txt

Sends a HEAD request

curl -I https://example.com

Sets a User Agent

curl  https://example.com -A 'Mozilla/5.0'

Sets a Header

curl -H 'Authorization: Basic YWRtaW46ABCtaW3=' http://alexrabocse.xyz

Sets a Username and Password

curl -u admin:admin http://xxxxxxxxxxx

Sends a POST

url -X POST -d 'username=admin&password=admin' http://xxxxxxxxxxxxxx
curl -b 'ABCDE=c00ck13exampl3' http://xxxxxxxxxxx
curl -H 'Cookie: ABCDE=c00ck13exampl3' http://xxxxxxxxxxx

Sends POST + Sets a Cookie + Defines the data format of payload

curl -X POST -d '{"subject":"test123"}' -b 'Cookie: ABCDE=c00ck13exampl3' -H 'Content-Type: application/json' http://xxxxxxxxxxxxx

Sends PUT

curl -X PUT http://xxxxxx/xxxx/xxxxx -d '{"subject":"test123"}' -H 'Content-Type: application/json'

Sends DELETE

curl -X DELETE http://xxxxxx/xxxx/xxxxx

 Share!

 
comments powered by Disqus