Short Introduction of CURL

Let's explore the most used tool

Are you Web Engineer who avoids cURL?

Let’s make it a little easy

  1. cURL, which stands for "client URL"
  2. It’s a command line tool that developers use to transfer data to and from a server. It runs on almost every platform

Basically, it helps you to talk to the server by asking or sending data. cURL supports several different protocols, including HTTP and HTTPS, FTP , etc.

Basic Syntax : curl [options] [url]

Let's explore examples:-

Type 1 : Command: curl example.com. It would return the HTML source for example.com.

Type 2 : Curl -I HTTPS:// example.com The -I option is only to fetch the HTTP header from a particular page

Type 3: Command : $ curl -o filename.txt example.com/index.html To save the contents of your download to a file, add the `-o' option

Type 4: Want to do GET or POST? , Just add —request Command: curl --request GET ‘https’:weatherapi.com’ -I Command: curl --request POST yourwebsite.com It would return data ( -i is used for HTTPS)

Type 5 : Command : curl -X POST lnkd.in/dHrh3B7M -d 'username=yourusername&password=yourpassword' d or --data option. The example below uses a POST request which sends login data to a login page of a particular website.

Feel Free to add commands that you commonly use Peace