DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk5 min

How to Use the curl Command to Make HTTP Requests

A practical curl guide to GET and POST requests, headers, response inspection, redirects, uploads, and troubleshooting.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use curl URL to make a basic HTTP GET request from a terminal. Add options to inspect response headers, send request headers or a body, upload a file, or diagnose a failure. curl transfers data; it does not render a webpage like a browser or interpret an API response for you.

Make a basic GET request

Open a terminal and run:

curl https://example.com/

A request to a URL uses GET by default. curl writes the response body to standard output, so the result may appear directly in your terminal. To save it to a named file, use -o:

curl https://example.com/ -o response.html

Use -O to save the response under the filename specified by the remote URL:

curl -O https://example.com/manual.pdf

The server decides what it returns. A successful transfer does not mean the response is HTML, valid JSON, or otherwise suitable for your intended use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect status, headers, and response content

Request headers only with HEAD

curl -I https://example.com/

-I makes a HEAD request, which asks for response headers without the response body. Some servers do not support HEAD or handle it differently from GET, so a failed HEAD request does not necessarily mean GET will fail.

Include response headers with the body

curl -i https://example.com/

-i keeps the usual request method and includes the returned headers in the output alongside the body. This is distinct from -I, which changes the request to HEAD.

Write response headers to a file

curl -D headers.txt https://example.com/

-D saves response headers separately, while the response body continues to go to standard output unless you also save it with -o.

Add request headers

Use -H or --header to send a header. For example, to tell an API you prefer JSON:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -H 'Accept: application/json' https://api.example.com/items

Headers communicate information such as the response format you prefer or credentials required by an API. Follow that API’s documentation for the exact header names and values it accepts. curl also allows an empty header value to suppress a header it would otherwise send; avoid copying empty-header overrides unless you intend that effect.

Send data with POST

Submit form-style data

curl -d 'name=Sam&role=editor' https://api.example.com/items

-d (also called --data) sends a POST body and uses application/x-www-form-urlencoded by default. Encode values appropriately when they contain characters with special meaning in URLs or form data. The endpoint determines which fields and formats it accepts.

Submit JSON

curl -H 'Content-Type: application/json' -d '{"name":"Sam"}' https://api.example.com/items

The content type describes the format of the body you are sending. Set it to match the body and the API contract; specifying JSON does not guarantee the server accepts that field or operation.

Preserve the body bytes

Use --data-binary when exact byte preservation, including newlines, matters. It also defaults to the form content type, so explicitly set another Content-Type when the endpoint expects a different format.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a method that matches the transfer

Prefer the option that performs the transfer you mean to make:

  • -I requests headers using HEAD.
  • -d sends data in a POST request.
  • -T or --upload-file uploads a file; for HTTP, this typically uses PUT.

An HTTP upload works only if the server is configured to accept it. -X or --request changes the method string curl sends; it does not make curl adopt the behavior associated with that method. For example, -X HEAD alone does not make a proper HEAD transfer. Use -I for that.

Rank #2
Visual Reference for Curl Types Hair Typing System Educational Chart Canvas Wall-Art Salon Wall Decor(Framed,12x18inch(30x45cm))
  • We have reserved a 0.6in (1.5cm) white margin for you, which is convenient for you to frame with a photo frame
  • Canvas posters are different from paper posters in that they will not deteriorate due to environmental factors such as humidity.
  • Because everyones monitor is different, the poster may have a slight color difference
  • Let it enhance your art space and decorate your home
  • If you like the same series of posters, welcome to click on my shop to buy

Follow redirects with care

Use -L or --location when you want curl to follow a redirect:

curl -L https://example.com/

Redirects can change where a request goes. A custom method set with -X can remain in use across redirects, potentially causing an unintended request to the destination. Sensitive headers or credentials may also be exposed to another server in relevant redirect configurations. Check the destination before forwarding credentials or cookies, and do not use --location-trusted casually.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose a failed request

See the request and response details

curl -v https://example.com/

Verbose mode displays protocol details that help identify what curl sent and what the server returned. For a more detailed trace, write an ASCII trace to a file:

curl --trace-ascii trace.txt https://example.com/

Check the response status and headers rather than assuming that a completed transfer means the server accepted the request. Verbose and trace output can contain tokens, cookies, credentials, personal information, and other private data. Protect these files and redact sensitive values before sharing them.

Common symptoms and next checks

  • The terminal shows a large response: curl writes the body to standard output by default. Save it with -o filename or use -O for the remote filename.
  • A HEAD request fails but the URL otherwise works: the server may reject HEAD. Try a normal GET and inspect it with -i if you need headers and body together.
  • The API rejects a POST: verify the method, body format, content type, required fields, authentication, and permissions against the API’s contract.
  • An upload is rejected: confirm that the server accepts uploads and that the endpoint expects the method and file format you sent.
  • A redirected request behaves unexpectedly: inspect the redirect destination and avoid carrying custom methods or sensitive headers to an unintended host.

Use curl for HTTP, not browser rendering

curl requests and transfers server responses. It does not display a page as a browser would, run a browser-based interaction flow, or automatically understand the application’s data. If your goal is to inspect the actual rendered appearance of a webpage, use a browser or a screenshot service rather than treating raw HTML or a response body as a visual capture.

Or skip the browser setup

If the goal is a webpage screenshot rather than a raw HTTP response, ScreenshotNeo offers a screenshot API and MCP server. A one-request example is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000. Sign up for free.

Check your installed curl version

Option availability and behavior can vary by curl version and build. For version-specific details, check curl --help or the installed man page. The official curl HTTP scripting guide, curl tutorial, curl man page, and curl known risks guidance provide further details. The project describes Everything curl as a free online book, also available as a PDF.

Frequently Asked Questions

Does curl render HTML like a web browser?

No. It transfers the server response; it does not render the page as a browser does.

Where can I check which curl options my installation supports?

Use curl --help or consult the man page installed for your curl version and build.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 2
Visual Reference for Curl Types Hair Typing System Educational Chart Canvas Wall-Art Salon Wall Decor(Framed,12x18inch(30x45cm))
Visual Reference for Curl Types Hair Typing System Educational Chart Canvas Wall-Art Salon Wall Decor(Framed,12x18inch(30x45cm))
Because everyones monitor is different, the poster may have a slight color difference; Let it enhance your art space and decorate your home
$35.96

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.