Skip to main content

Command Palette

Search for a command to run...

Short Introduction of CURL

Let's explore the most used tool

Published
1 min read
Short Introduction of CURL
V

👋 Hi there, I'm Vivek ! I am a Frontend Engineer . I write beginner friendly articles from web development, side projects, and life as dev

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 http://example.com. It would return the HTML source for example.com.

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

Type 3: Command : $ curl -o filename.txt www.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 https://yourwebsite.com It would return data ( -i is used for HTTPS)

Type 5 : Command : curl -X POST https://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