How to use proxies with cURL
cURL takes a proxy with the -x flag and credentials with -U, which makes it the fastest way to confirm that a proxy, its credentials and its geo-targeting all work before wiring them into anything larger.
Recommended for cURL
Residential proxies — cURL is mostly used here for verification, and the residential gateway is where targeting and rotation options are worth checking.
See residential proxiesSetup
- 1
Send a request through the proxy
Use -x for the proxy and -U for the credentials. Replace PROXY_HOST, PROXY_PORT, USERNAME and PASSWORD with the endpoint and credentials shown in your seamless dashboard.
curl -x http://PROXY_HOST:PROXY_PORT -U USERNAME:PASSWORD https://api.ipify.org?format=json - 2
Or put credentials in the URL
A single combined flag is more convenient in scripts and environment variables.
curl -x http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT https://example.com - 3
Use SOCKS5
Switch protocol with the scheme. Use socks5h rather than socks5 so DNS is resolved at the proxy instead of locally, which avoids leaking the hostnames you look up.
curl -x socks5h://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT https://example.com - 4
Check geo-targeting and timing
Confirm the exit country is what you asked for, and measure where the time actually goes.
# Which country did we exit from? curl -x http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT https://ipinfo.io/json # Where is the latency? curl -x http://USERNAME:PASSWORD@PROXY_HOST:PROXY_PORT \ -o /dev/null -s \ -w "connect: %{time_connect}s ttfb: %{time_starttransfer}s total: %{time_total}s\n" \ https://example.com
cURL proxy FAQ
How do I use a proxy with cURL?
Pass the proxy with -x http://host:port and the credentials with -U username:password, or combine both as -x http://username:password@host:port. The same syntax works for SOCKS5 by changing the scheme.
What is the difference between socks5 and socks5h in cURL?
With socks5, cURL resolves the hostname locally and sends the resulting IP to the proxy. With socks5h, the proxy performs the DNS lookup. socks5h is normally what you want, because it prevents your local resolver from seeing which hosts you are visiting.
How do I check which IP a proxy is exiting from?
Request an IP echo service through the proxy, for example curl -x http://user:pass@host:port https://ipinfo.io/json. The address and country it returns are what the target site will see.
Before you scale this up

HTTP vs SOCKS5 Proxies: Which Should You Use?
What actually differs between the two protocols, which one your tool needs, and why the choice matters far less than most guides suggest.
Read guide
What Is a SOCKS5 Proxy?
What SOCKS5 actually does at the protocol level, how the handshake works, what socks5h changes, and when it beats an HTTP proxy.
Read guide
Proxy Error Codes Explained: 407, 429, 502 and the Rest
Which errors come from the proxy and which from the target, why that distinction saves hours, and the specific fix for each code.
Read guide