Skip to main content

Command Palette

Search for a command to run...

What is cURL

Published
2 min read

What is server

A server is a computer that provides data or services, and we talk to servers access websites, APIs, and online information.

Why we need servers

Your laptop or phone is not always online, has limited storage and power, is meant for personal use.
Servers exist because websites must be available 24/7, data must be shared with many users at the same time, heavy processing should not run on user devices.
So server handles websites(HTML,CSS,JS), APIs and databases, user accounts and data, emails, files, videos.

why we need to talk to servers

Every time you open a website, log in to an app, fetch data from API, submit a form your device(client) sends a request to a server.
The server processes the request and sends back a response.
This communication usually happens using HTTP over TCP.

What is cURL

cURL is a command-line tool used to send requests to servers and receive responses over the internet.
cURL lets you talk to a severe directly from the terminal, without using a browser.

cURL is used for:
Making HTTP requests like GET, POST, PUT, DELETE, PATCH.
It helps to test APIs.
Seeing headers, status code, and response data.
Debugging server issues.

Making Your FIrst Request Using cURL

  1. Open the terminal

  2. Run simple cURL command

     curl -UseBasicParsing https://example.com
    

    This is the best first command because it is public website, no authentication, always works, returns readable content.

  3. What this command means
    curl → the tool
    https://example.com → server address
    It means sends a request to this server and show me the response.

  4. What actually happens behind the scenes
    cURL creates an HTTP request.
    It sends the request to the server.
    The server receives the request.
    The server sends back a response.
    cURL prints the response in the terminal.

  5. What output you will see
    The output is HTML, it may look messy that’s normal.
    cURL shows raw server output, not a rendered webpage.

Understanding Request and Response

  1. Request
    The request is sent by cURL to the server.
    It asks the server for data.
    curl https://example.com

  2. Response
    The response is sent by the server back to cURL.
    The response contains Status code like 200,400.
    Data like HTML, text, JSON.

  3. cURL prints this response directly in the terminal.

Conclusion

cURL is a powerful yet beginner-friendly tool that helps developers understand how clients and servers communicate. By using cURL, you gain a clearer picture of how requests are sent, how servers respond, and how APIs work internally.

##