# Getting Started with cURL

If you are learning backend development, APIs, or even basic web concepts, you will hear the word **cURL** again and again. At first it looks scary a black terminal, strange commands, and confusing responses.

This blog is written to **remove that fear**.

No overload. Just clear thinking.

### ❀ Before cURL: What is a Server?

⤷ A **server** is simply a computer that is always connected to the internet and waits for requests.

Examples of what servers do:

* Send a webpage (HTML, CSS, JS)
    
* Return user data from a database
    
* Accept form submissions
    
* Provide APIs for mobile apps
    

Whenever you:

* Open a website
    
* Submit a login form
    
* Scroll Instagram
    

You are **talking to a server**.

## ❀ How Do We Talk to a Server?

⤑ To talk to a server, we send a **request**.

That request contains:

* What we want (data, page, action)
    
* Where we want it from (URL)
    
* Sometimes extra data (login info, form data)
    

⤑ The server then sends back a **response**.

That response contains:

* Status (success or failure)
    
* Data (HTML, JSON, text, etc.)
    

## ❀ Where Does cURL Come In?

⤷ Normally, browsers send requests for us.

But programmers often want to:

* Test APIs
    
* Debug backend issues
    
* Call a server without a browser
    
* Automate requests
    

This is where **cURL** is used.

⤑ **cURL is a tool that lets you send requests to a server from the terminal.**

Think of it as:

**Terminal → Server → Response**

## ❀ What is cURL ?

⤑ **cURL = Command Line URL tool**

⤑ **cURL** is a way to send messages to a server using text commands.

No UI. No buttons. Just pure communication.

## ❀ Why Programmers Need cURL ?

⤷ Programmers use cURL because:

* It works everywhere (Linux, Mac, Windows)
    
* No browser required
    
* Perfect for backend and API testing
    
* Helps understand how HTTP really works
    

## ❀ Understanding Request and Response

### ⤑ Request (What You Send)

A basic HTTP request includes:

* Method (GET / POST)
    
* URL
    
* Headers (optional for now)
    
* Body (only for POST)
    

Example :

GET / HTTP/1.1

Host: [prakashtsx.me](http://prakashtsx.me)

### ⤑ Response (What You Get Back)

A response includes:

* Status code (200, 404, 500)
    
* Headers
    
* Data (HTML, JSON, text)
    

Example :

HTTP/1.1 200 OK

Content-Type: text/html

&lt;html&gt;...&lt;/html&gt;

## ❀ Status Codes :

* **200** → Success
    
* **404** → Not Found
    
* **500** → Server Error
    

## ❀ Using cURL to Talk to APIs

APIs usually return **JSON**, not HTML.

Example:

curl [https://api.github.com](https://api.github.com)

We will see JSON data in response.

This is how:

* Frontend talks to backend
    
* Mobile apps talk to servers
    
* Services talk to other services
    

## ❀ GET vs POST (Only What We Need)

### ⤷ GET

* Used to **fetch data**
    
* Default method in cURL
    

curl [https://api.example.com/users](https://api.example.com/users)

### ⤷ POST

* Used to **send data**
    

curl -X POST [https://api.example.com/login](https://api.example.com/login)

## ❀ Browser Request vs cURL Request (Conceptual)

**Browser:**

* UI + request + rendering
    

**cURL:**

* Only request + response
    

Same protocol. Same server. Different interface.

## ❀ Where cURL Fits in Backend Development

cURL helps you:

* Test APIs before frontend exists
    
* Debug server issues
    
* Understand HTTP deeply
    
* Think like a backend engineer
