Why you should learn Curl

1 minute read

curl

Curl is a command line program that allows us to transfer data over different protocols. Curl stands for “Client for URLs”. Curl deals with a bunch of Internet Protocols like HTTP, FTP, SMTP, TELNET etc.
To check if Curl exists in your System using the command:

1curl --version

if there is no response, you can install curl from https://curl.haxx.se/dlwiz/.

Save the output to a file

1curl -O https://funkgewitter.de/readme

Query the Header of a website

1curl -I https://funkgewitter.de

GET-Method

1curl --request GET https://funkgewitter.de

POST-Method

1curl --request POST https://funkgewitter.de

POST-Request with data, login

1curl -X POST https://funkgewitter.de/login -d 'username=blablaname&password=supersecret'

How to send a HTTP request with a header

GET with JSON

1curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://funkgewitter.de/api/info

POST Data

1curl --data "param1=value1&param2=value2" http://funkgewitter.de/api/info