What is curl? The commands you actually need, proxies included
By the ProxyOnly team · 16 Nov 2026 · 5 min read
What curl is, how it differs from wget, and the commands you actually use, from headers, redirects, JSON and downloads to timing and proxies, each run with real output.
curl is a command line tool that transfers data to and from a URL. You give it an address, and it prints what the server sends back. It comes preinstalled on macOS, Windows 10 and 11 and most Linux systems, and it is the quickest way to see exactly what a website or an API does, without a browser in the way.
This guide covers the commands people actually use, from reading headers to sending JSON and going through a proxy. We ran every command on 16 November 2026 with curl 8.7.1 on macOS, against httpbin.org and test servers on our own machine, and the output shown is what came back.
What curl does, and how it differs from wget
curl makes one transfer per URL you give it and prints the result. It is built on libcurl, a library that many other programs use for their own transfers. Daniel Stenberg, who created curl, keeps a page comparing curl and Wget. In short, curl has no recursive download logic or HTML parser and speaks many more protocols, while Wget can download whole sites recursively and only supports HTTP, HTTPS and FTP. Use curl to talk to one URL in detail, and Wget to mirror a site.
The basic request
$ curl -s "https://httpbin.org/get?q=proxy" | head -5
{
"args": {
"q": "proxy"
},
"headers": {-s hides the progress bar. Quote URLs that contain ? or &, or the shell will read those characters itself.
See the headers
-I asks for the headers only, and -i shows headers and body together. Both are how you see status codes, redirects and caching rules.
$ curl -sI https://httpbin.org/redirect/2
HTTP/2 302
access-control-allow-credentials: true
access-control-allow-origin: *Follow redirects
curl does not follow redirects unless you ask. Add -L. The -w option prints details after the transfer, here the final status, the number of redirects and where it ended.
$ curl -sL -o /dev/null -w "%{http_code} after %{num_redirects} redirects: %{url_effective}\n" https://httpbin.org/redirect/2
200 after 2 redirects: https://httpbin.org/getSend headers and a user agent
-H adds a header and -A sets the user agent. httpbin.org echoes back what it received.
$ curl -s -H "Accept-Language: de-DE" -A "price-checker/1.0 (+https://example.org/bot)" https://httpbin.org/headersThe echo showed Accept-Language: de-DE and the user agent exactly as sent. User agents explained covers what curl sends by default.
POST a form or JSON
-d sends form data and switches the method to POST. --json sends JSON and sets the content type and accept headers for you.
$ curl -s -d "user=maria" -d "plan=basic" https://httpbin.org/post
$ curl -s --json '{"sku": "A-100", "qty": 2}' https://httpbin.org/posthttpbin.org reported the first as a form with user and plan and the content type application/x-www-form-urlencoded, and the second as JSON with the content type application/json. curl's manual describes --json as a shortcut for sending the data as-is with those two headers, and notes that it does not check the JSON for you.
Download a file
-o saves to the name you give and -O keeps the server's file name. Add -C - to resume a download that stopped.
$ curl -s -o dl/robots.txt https://httpbin.org/robots.txt && ls -l dl
30 robots.txtCertificate errors, and what -k really does
When a site's certificate cannot be verified, curl stops.
$ curl -sS https://self-signed.badssl.com/
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.se/docs/sslcerts.html-k turns the check off, and the same request then returned 200. Use it only against your own test servers. With the check off, curl cannot tell the real site from someone in the middle, which is the whole point of HTTPS.
Time a request
The -w variables split a request into its steps, which helps you tell a slow DNS lookup from a slow server or a slow proxy.
$ curl -s -o /dev/null -w "dns %{time_namelookup}s connect %{time_connect}s tls %{time_appconnect}s total %{time_total}s\n" https://httpbin.org/get
dns 0.018483s connect 0.119730s tls 0.235492s total 0.350062sEach time is measured from the start, so the TLS handshake here took about 0.12 seconds after the connection was made.
Use a proxy
-x sets the proxy and -U the proxy login. The proxy URL starts with http:// even when the site is HTTPS, because curl reaches the proxy over plain HTTP and asks it to open a tunnel. We used a test proxy that requires a login.
$ curl -s -o /dev/null -w "%{http_code}\n" -x http://127.0.0.1:8101 -U demo:s3cret https://httpbin.org/ip
200The proxy logged CONNECT httpbin.org:443. With your own proxy, put the host and port from your order page after -x, and the username and password after -U. -U also spares you from encoding special characters. A password containing @, : and / worked as typed with -U, while inside a proxy URL it would need percent-encoding.
To watch the tunnel being set up, add -v. These are the lines that concern the proxy:
* Connected to 127.0.0.1 (127.0.0.1) port 8101
* Establish HTTP proxy tunnel to httpbin.org:443
> CONNECT httpbin.org:443 HTTP/1.1
> Proxy-Authorization: Basic ZGVtbzpzM2NyZXQ=
< HTTP/1.1 200 Connection established
* CONNECT tunnel established, response 200The Proxy-Authorization line is the username and password in Base64, which anyone can decode, so do not paste -v output from a real account into a ticket or a chat.
Proxy settings from the environment
curl also reads proxy settings from environment variables, with one trap. In our test:
https_proxyandHTTPS_PROXYwere both used forhttps://addresses.- For
http://addresses, the lowercasehttp_proxywas used and the uppercaseHTTP_PROXYwas ignored. The request went direct and the proxy logged nothing. --noproxy httpbin.org, or theno_proxyvariable, made curl skip the proxy for that host.
Other proxy options worth knowing
-pmakes curl open a tunnel even for plainhttp://addresses. Our test proxy loggedCONNECT 127.0.0.1:9201instead of a normal request.--socks5-hostnamesends the request through a SOCKS5 proxy and lets the proxy look up the name. SOCKS4 vs SOCKS5 vs HTTP shows what each SOCKS option sends.-K filereads options from a file, so a proxy can live outside your command history. A file containingproxy = "http://127.0.0.1:8104"andmax-time = 20worked withcurl -K proxy.curlrc.
When a proxy request fails
curl's exit code says which step failed: 5 means the proxy name did not resolve, 7 means nothing listened on the port, 28 is a timeout, 56 with "CONNECT tunnel failed" means the proxy refused the tunnel, and 97 is a SOCKS problem. Every common proxy error maps each message to its cause, and our quick start guide to testing a proxy with curl has the one command to run first.
Try it yourself
Create an account, add funds from US$1 and order a proxy in the country you need.
Keep reading
25 Nov 2026 · Tutorials
Python HTTP clients compared: requests vs httpx vs aiohttp
A tested comparison of requests, httpx and aiohttp, including a benchmark where the run-to-run noise turned out to be larger than the gap people argue about.
25 Nov 2026 · Tutorials
How to find your proxy server address and port
Find the proxy your machine is already configured to use on Windows, macOS, Linux and in browsers, or find the host and port of a proxy you bought.