Using cURL with an authenticated proxy: commands that prove it works
Updated:
To run cURL through a proxy, give it the proxy address with -x and your login with -U, or put both in one http://user:pass@ip:port URL. Before you wire a ProxyV4 IP into a scraper, a browser profile or a cron job, one cURL call from the same machine tells you three things fast: the credentials are accepted, the exit IP is the one you rented, and the round trip is reasonable.
curl -x http://user:pass@ip:port https://proxyv4.com/api/my-ipFrom the dashboard line to a cURL argument
Your order arrives as ip:port:user:pass. cURL does not read that layout directly, so split it: the first two fields go into -x http://ip:port, the last two into -U user:pass. The single-URL form http://user:pass@ip:port is shorter, but any @, : or # inside the password then has to be percent-encoded, which is why the split form is the safer default in scripts.
Keep the http:// scheme on the proxy even when the target is https://. cURL talks plain HTTP to the proxy, asks it to open a tunnel with CONNECT, and then runs TLS to the website through that tunnel, so the page itself stays encrypted end to end.
Command reference
| Goal | Command | Read the result |
|---|---|---|
| See which IP the internet sees | curl -x http://user:pass@ip:port https://proxyv4.com/api/my-ip | The address printed should equal the proxy IP, not your own |
| Pass the login separately | curl -x http://ip:port -U "user:pass" https://proxyv4.com/api/my-ip | Same output; no URL encoding needed for odd password characters |
| Status line and headers only | curl -I -x http://user:pass@ip:port https://example.com | A 2xx or 3xx line means the target answered through the proxy |
| Connect time and time to first byte | curl -s -o /dev/null -w "Connect:%{time_connect}s TTFB:%{time_starttransfer}s\n" -x http://user:pass@ip:port https://example.com | Two numbers in seconds; compare them across proxies or locations |
Debugging a failed request with -v
Add -v and read the lines that start with > and <. A healthy run shows cURL sending CONNECT with a Proxy-Authorization header and the proxy replying HTTP/1.1 200 Connection established, followed by the TLS handshake with the target.
If the reply is HTTP/1.1 407 Proxy Authentication Required, the connection to the proxy worked and only the username or password is wrong; the 407 error guide walks through the usual causes. If cURL never gets a reply at all, the problem is reachability, so check the IP and port first with the port checker.
Windows, scripts and defaults
- Windows PowerShell maps
curltoInvoke-WebRequest, which does not understand-x; typecurl.exeto reach the real binary - On Windows, swap
-o /dev/nullfor-o NULin the timing command - In cron jobs and shell scripts add
--connect-timeout 5 --max-time 15so one slow target cannot stall the whole run - To route every cURL call through the same proxy, put
proxy = "http://user:pass@ip:port"in~/.curlrcand remove it when you are done testing
Step by step
- 1
Open a shell
Use Terminal on macOS or Linux, or cmd / PowerShell on Windows (where the command is
curl.exe). - 2
Request your exit IP through the proxy
Run
curl.exe -x http://user:pass@ip:port https://proxyv4.com/api/my-ipwith the values from your ProxyV4 order and check that the printed address is the proxy IP. - 3
Look at the handshake if it fails
Repeat the call with
-vand find the proxy's reply toCONNECT: 200 means the tunnel opened, 407 means the login was refused. - 4
Harden the command for automation
Before the line goes into a script, add
--connect-timeout 5 --max-time 15.
Frequently asked questions
Why does PowerShell reject `curl -x` with a parameter error?
In PowerShell, curl is an alias for Invoke-WebRequest, which has no -x option. Call curl.exe -x http://user:pass@ip:port ... and Windows runs the native cURL instead.
cURL shows `407 Proxy Authentication Required`. Is the proxy down?
No. A 407 is an answer from the proxy, so the IP and port are reachable. The username or password given to -x or -U did not match; copy them again from the order and watch for special characters in the password.
Do I have to loop cURL to test a whole list of proxies?
Not for a quick health check. The web proxy checker takes up to 100 proxies at once and does not store passwords, and the proxy speed test compares latency without a script.
Private IPv4 that passes the cURL test
One customer per IP, unmetered bandwidth, HTTP(S) with user and password, in 7 countries. Check the live prices.
See live proxy prices