Sitemap

curl

1 min readJun 15, 2026

The Problem

How do you test backend APIs directly without building a front end? How do you inspect what’s actually sent over the wire? curl provides a CLI interface to speak HTTP directly — essential for backend development and debugging.

Core Idea

curl is a command-line tool that sends HTTP requests and prints the response. It bypasses browsers — you can directly test endpoints, inspect headers, send POST data. It’s the backend developer’s direct connection to the server.

How It Works

  1. Parse URL: curl extracts protocol, domain, port, path from the URL
  2. DNS Lookup: Resolves domain to IP address
  3. Socket Connection: Opens TCP socket to IP:port
  4. TLS Handshake: For HTTPS, establishes encrypted connection
  5. Send Request: Writes raw HTTP request text to socket
  6. Receive Response: Reads response from server and prints to terminal

Get Animesh Mishra’s stories in your inbox

Join Medium for free to get updates from this writer.

Example: curl https://example.com sends GET / HTTP/1.1 and prints the HTML response.

Key Properties

  • CLI tool available on all major operating systems
  • Supports multiple protocols: HTTP, HTTPS, FTP, etc.
  • Options: -X (method), -H (headers), -d (body), -v (verbose)
  • Great for API testing: curl -X POST -H "Content-Type: application/json" -d '{"name":"ani"}' https://api.example.com
  • -v flag shows full request/response headers and connection details
  • Does not execute JavaScript like browsers do

--

--

Animesh Mishra
Animesh Mishra

Written by Animesh Mishra

He who knows his why can bear almost any how