/posts

Why you should learn Curl

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:

Bash
curl --version

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

Save the output to a file #

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

Query the Header of a website #

Bash
curl -I https://funkgewitter.de

GET-Method #

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

POST-Method #

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

POST-Request with data, login #

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

How to send a HTTP request with a header #

GET with JSON #

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

POST Data #

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