Getting Started with cURL

What is a server and why we talk to it
First basic thing.
A server is just another computer on internet.
This computer stores websites, data, APIs, images, everything.
When we open a website in browser, we are actually talking to a server.
We send request → server sends response.
Browser hides all this.
But sometimes as a developer, we want to talk to server directly.
This is where cURL comes.
What is cURL
cURL is a tool to send request to a server from terminal.
In simple words:
cURL = way to talk to server without browser
Using cURL, we can:
get data from a website
send data to an API
test backend responses
It works using command line (terminal / CMD).
Why programmers need cURL
As a beginner I asked: why not just use browser?
Because cURL helps when:
we want to test APIs
we want to see raw response (JSON, text)
browser is not needed
frontend is not ready yet
Backend developers use it a lot.
Frontend developers also use it for API testing.
Making your first cURL request
This is the simplest command.
curl https://example.com
What happens?
cURL sends a request to example.com
server sends HTML response
terminal prints the response
It feels like magic first time
Understanding request and response
Every communication has two parts.
Request
What we send to server:
URL
method (GET, POST)
sometimes data
Response
What server sends back:
status code (200, 404, 500)
data (HTML, JSON, text)
Simple flow diagram
You (cURL)
|
| Request
v
Server
|
| Response
v
Terminal output
Browser request vs cURL request
Both do same job but look different.
Browser:
Click URL → Browser → Server → Page UI
cURL:
Command → Terminal → Server → Raw data
Browser shows UI.
cURL shows raw response.
Using cURL to talk to APIs
APIs mostly return JSON data.
Example:
curl https://api.example.com/users
Response might look like:
[
{ "name": "Aman", "age": 22 },
{ "name": "Riya", "age": 21 }
]
This is very useful to check:
API is working or not
data structure
GET and POST
GET
Used to get data.
curl https://api.example.com/posts
POST
Used to send data.
curl -X POST https://api.example.com/login
For now, just remember:
GET = ask something
POST = send something
No need to remember all flags now.
Common mistakes beginners make with cURL
I also did these mistakes
Forgetting
https://Copying long commands without understanding
Panicking when response is too long
Thinking error means cURL is broken
Errors are normal.
They actually help learning.
Where cURL fits in backend learning
Frontend (HTML/CSS/JS)
|
v
API
|
v
Server
^
|
cURL
cURL helps us understand:
how frontend talks to backend
how APIs behave
what server actually returns
Short Summary
cURL is a simple tool to talk to servers using terminal.
It helps developers test websites and APIs without browser.
As a beginner, start with small GET requests.
Do not fear terminal. Practice slowly.
cURL is optional, but very powerful when you understand basics.



