Exploring the web from the command line : Requests, Responses and cURL
When you search for a website on the internet using Google Chrome or any other web browser, the website you want does not just magically appear on your screen — A very intricate yet fast chain of events dictate this very simple process of viewing websites over the internet.
The Internet is just a gigantic computer network that’s spread across the whole world, and networks are just computers connected together using some cables. Following our very basic interpretation of a network, the computer you use to view a website is called the “Client” and the computer that holds the data for that website is called the “Server” — The client requests for information (website data, in our case) and the server “serves” the information to the client computer. The server only responds when the client requests for information. This communication between a client and a server is called the Client-Server model
HTTP : language of the web
The conversation between a client (your computer) and the server is what enables you to view a website over the web. The client and server converse using HTTP (Hyper Text Transfer Protocol) requests and responses — HTTP is an application layer network protocol (networking jargon, don’t stress over it for now). The client sends of an HTTP request to the server, the server processes that request and sends back an HTTP response.
The browser running on the client computer sends these HTTP requests to the server, requesting for the website data. The server then responds with the website data in the form of HTML files — HTML ( Hyper Text Markup Language ) is what developers use to structure the content of a website.

HTTP requests
There are different types of HTTP requests which are categorized according to their purpose. We will look into two types of HTTP requests: GET and POST. We start by taking a glimpse on, what is an API ?
What is an API ?
An API (Application Programming Interface) defines all the rules and techniques through which applications on the Internet communicate with each other. Think of APIs as pre-defined methods of communication between various applications over the Internet for accessing the services they provide. For example, you may have seen various websites or services use Google’s API for login and account creation processes. Another example can be an e-commerce platform using Stripe or RazorPay APIs for online payment processing.
Applications (client) communicate with APIs (server) over HTTP. The GET request is sent to retrieve information from an API server and the POST request sends data to create new resources or trigger actions on the API server.
GET request
The HTTP request which is used whenever the client requests for some data from the server, in the example of you viewing a website; the web browser sends an HTTP GET request to the server requesting the webpage for displaying it on the screen.
POST request
The HTTP request used to sends data to the API server to create new resources or trigger some action. For example, you want to create an account on an e-commerce website. You fill out a basic sign-up form and click “create an account”, all the data entered is sent to the website’s server using the HTTP POST request.
POST requests often include a Request Body which carries all the content that needs to be sent to the server (for example, the form data you entered on the e-commerce website). Most often, the Request Body contains data in the JSON (JavaScript Object Notation) format. To keep it simple, JSON is a human-readable text format used for exchanging and storing data.
Example data in JSON:
{
"user-id" : 001,
"username" : "abc",
"age" : 23,
"email" : "abc@mail.com"
}
Whenever an API is contacted using a GET or a POST request, most commonly the data sent or retrieved is in the form of JSON.
Alright, with this small introduction to the Client-Server Model, Request-Response and HTTP. Lets now explore the web through the terminal of your computer, we will be using a CLI ( Command Line Interface) tool called cURL which is used to send HTTP requests and receive HTTP responses from the terminal itself without using a web browser.
cURL
On a Windows system, cURL comes pre-installed and we just need to type “curl” followed by a correct URL to send a basic GET request.
We will be making a GET request to a test domain named “https://www.example.com” and fetch its contents.
C:\Users\user> curl https://www.example.com
We get the complete HTML for the URL as output.

Getting the Request Headers using the -I flag :
- The
-I(uppercase ‘I’) flag can be used to get the Request Headers which contain additional information related to the GET request we made.
C:\Users\user> curl -I https://www.example.com
HTTP/1.1 200 OK
Date: Wed, 21 Jan 2026 15:14:34 GMT
Content-Type: text/html
Connection: keep-alive
CF-RAY: 9c17c3129d6b80c2-BOM
last-modified: Tue, 20 Jan 2026 22:16:09 GMT
allow: GET, HEAD
CF-Cache-Status: HIT
Age: 12390
Accept-Ranges: bytes
Server: cloudflare
- The flag
-i(lowercase ‘i’) also gives the Request Headers, but along with it also prints the content (HTML) we received earlier.
Downloading the response from a GET request to a separate file :
The
-o(lowercase “o”) is used to download the response from a GET request in a separate file of your choice.C:\Users\user> curl -o example.html https://www.example.com % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 513 0 513 0 0 4062 0 --:--:-- --:--:-- --:--:-- 4104We downloaded the HTML we received into a file named “example.html” in the current directory. The details printed are just metrics for the download percentage and speed.
Sending a POST request using cURL
We need to specify our request type using the
-X(uppercase ‘X’) followed byPOST.Also, the flags
-H(uppercase ‘H’ ) and-d(lowercase ‘d’) are used whenever we send a POST request.The flag
-H(uppercase ‘H’ ) represents the Request Headers, in this case the format in which data is sent.The flag
-d(lowercase ‘d’) represents the Request Body, the actual data we want to send.C:\Users\user> curl -X POST https://www.example.com/add-user^ -H "Content-Type:application/json"^ -d '{"name":"abc","email":"abc@mail.com","country":"IN"}'We specified our data to be in the JSON format using the
”Content-Type:application/json”Request Header followed by the Request Body containing our JSON data.This would send the data to the website server for processing and creating a new user with details provided by us in the Request Body.
What’s next ?
Till now we got to know a little bit on how applications on the web communicate with each other and also got to know cURL and its flags. We only used cURL to fetch a webpage and to send some fabricated data to a non-existent example user creation page, which was just a small glimpse on what cURL can do and how it helps developers across the world to test and debug APIs.
Internet, the technology from the 1970s is still one of the most impressive and intricate creations by humans. Tools like cURL help us to understand this intricate mechanism of computers communicating with each other.