Skip to content

Instantly share code, notes, and snippets.

@bbrother92
Last active September 19, 2020 19:05
Show Gist options
  • Save bbrother92/71d5b5ced8b68bb391bba1fd323e2d38 to your computer and use it in GitHub Desktop.
Save bbrother92/71d5b5ced8b68bb391bba1fd323e2d38 to your computer and use it in GitHub Desktop.

GET is default, using -d or -F makes it a POST, -I generates a HEAD and -T sends a PUT.

Download

curl -O README.md  download and save with orginal name or -o (lowercase o) the result will be saved in the filename provided
curl -u ftpuser:ftppass -O ftp://ftp_server/public_html/xss.php download files from FTP servers

Send data

curl -X POST -d '{"updated_field1":"updated_value1"}' http://example.com
curl -X POST curl -d @test.json http://example.com

Upload file

curl -F "image=@/home/user1/Desktop/test.jpg"

Options

-k: not check SSL certificates
-L: follow redirects
-v: get verbose output
-i: response headers

Send Mail using SMTP Protocol

curl --mail-from blah@test.com --mail-rcpt foo@test.com smtp://mailserver.com
Or:
curl --url 'smtps://smtp.gmail.com:465' --ssl-reqd \
  --mail-from 'username@gmail.com' --mail-rcpt 'john@example.com' \
  --upload-file mail.txt --user 'username@gmail.com:password' --insecure

Links

Everything curl

binary-data-posting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment