Set up curl with ProxyField
- Copy your login and password from the ProxyField dashboard.
- Add
-x gate.proxyfield.io:7000and-U "<login>-country-us-city-new_york:<password>"to the command. - Request
https://api.ipify.org: it prints the exit IP, not yours; add-vto see the proxy handshake. - For SOCKS5, use
-x socks5h://gate.proxyfield.io:7000with the same-U. - To proxy every call, set
https_proxyandhttp_proxy, or putproxyandproxy-userlines in~/.curlrc.
The same settings as one command, with a New York exit IP.
curl -x gate.proxyfield.io:7000 -U "<login>-country-us-city-new_york:<password>" https://api.ipify.orgcurl's own reference for -x, -U and socks5h://: curl - How To Use (curl man page).
SOCKS5 with a username and password: curl -x socks5h://gate.proxyfield.io:7000 --proxy-user "<login>:<password>" https://api.ipify.org. The h makes the proxy resolve the hostname. When a SOCKS5 server rejects the login, curl prints curl: (97) User was rejected by the SOCKS5 server (1 1). (section 5)
A proxy for every call: export https_proxy="http://<login>:<password>@gate.proxyfield.io:7000" (and http_proxy, lowercase only), or proxy and proxy-user lines in ~/.curlrc. -x beats ~/.curlrc, which beats the variables; $CURL_HOME/.curlrc is read before ~/.curlrc (section 7).
A rotating residential gateway for curl scripts: one endpoint, gate.proxyfield.io:7000, gives a new IP on every request, or one IP for 30 s to 36 h with -session-<id>-ttl-<seconds> in the username, from $1.95/GB (section 2).
Mobile 5G/4G proxies cost $3.45/GB for 1 GB down to $2.45/GB from 1,000 GB on the same gateway and balance, over HTTP, HTTPS and SOCKS5.
Replace <login> and <password> with your dashboard credentials.
cURL proxy options at a glance
| Option | What it does |
|---|---|
-x, --proxy | The proxy URL: scheme://[user:; without a port, curl uses 1080 |
-U, --proxy-user | The proxy's username:password |
--socks5-hostname | A SOCKS5 proxy that resolves the hostname (same as socks5h://) |
--socks5-basic | SOCKS5 username/password authentication (on by default) |
--noproxy | Hosts that skip the proxy; "*" skips it for all hosts |
--proxy-insecure | Skips the certificate check of an https:// proxy |
-v, --verbose | Shows the proxy handshake and its response |
-q, --disable | Ignores ~/.curlrc (must be the first option) |
-K, --config | Reads options from another config file |
On this page 13 sections
1. The basic command
Pass the proxy with -x and its credentials with -U; for HTTPS sites, curl opens a CONNECT tunnel through the proxy.
curl -x http://gate.proxyfield.io:7000 -U "<login>:<password>" https://api.ipify.orgOr put the credentials in the proxy URL:
curl -x "http://<login>:<password>@gate.proxyfield.io:7000" https://api.ipify.orgIn the URL form, encode special characters in the password: p@ss:word becomes p%40ss%3Aword. With -U, no encoding is needed. Without a scheme, curl treats the proxy as an HTTP proxy. To keep the password out of the command itself, use variables:
PROXY_USER="<login>"
PROXY_PASS="<password>"
curl -x http://gate.proxyfield.io:7000 -U "$PROXY_USER:$PROXY_PASS" https://api.ipify.orgOn shared machines, prefer ~/.curlrc (section 7): command-line arguments can be briefly visible to other users.
2. Rotating residential gateway for curl scripts
ProxyField gives curl scripts one rotating residential endpoint, gate.proxyfield.io:7000: every request gets a new IP, so a script needs no proxy list and no rotation code. Residential traffic costs $2.95/GB for 1 GB down to $1.95/GB from 1,000 GB, with a 99.6% success rate, according to our service data, and unlimited concurrent threads.
Read moreShow less
What to look for in any rotating gateway you script with curl, and what ProxyField has:
| A curl script needs | How to check any provider | ProxyField |
|---|---|---|
| One endpoint for every request | one host:port, no proxy list to rotate yourself | gate.proxyfield.io:7000 |
Authentication that fits -U | username:password, or an IP allowlist for servers | username:password on port 7000, or an IP allowlist on the port you set up in the dashboard |
| A new IP per request | two calls to an IP-echo URL return two IPs | yes, on every request |
| One IP across several requests | a sticky session set in the username | sticky sessions, 30 s to 36 h (-session-<id>-ttl-<seconds>); 20 min when ttl is left out |
| Protocols | HTTP for -x http://, SOCKS5 for socks5h:// | HTTP, HTTPS, SOCKS5 |
| Parallel requests | no cap on threads, or a stated one | unlimited concurrent threads |
| Location in the username | country and city at least | country, region and city; all 50 US states; 412M+ residential IPs in 195+ countries |
| Pricing | per GB, with a small first purchase | per GB: $2.95 (1 GB), $2.79 (10 GB), $2.65 (50 GB), $2.49 (100 GB), $2.29 (250 GB), $2.09 (500 GB), $1.95 (1,000 GB); the tier rate applies to the whole purchase |
| Targeting at no surcharge | the same price for country, region and city | no surcharge for country, region or city |
| No subscription, no expiry | a quiet month should cost nothing | no subscription; the traffic never expires |
| Help | live chat for setup | 24/7 live chat, including setup and integration |
From the dashboard to the first curl call:
- In your account, copy the login and password, or add your server's IP to the allowlist and use the port you set up in the dashboard.
- Generate lines in the configurator if your tool wants a list: it makes as many proxy lines as you need, all on
gate.proxyfield.io:7000. - Run the command below twice, then watch usage and the remaining gigabytes in the dashboard, which update in real time.
What "a new IP on every request" means for curl: each curl process that connects to the gateway gets a new exit IP, so one process per request (as in the loops below) rotates on every call; the same session id in the username keeps one IP until its ttl ends. Several URLs in one curl call can reuse one connection, and an open HTTPS connection keeps one exit IP until it closes.
Run the same command twice and you get two exit IPs:
curl -s -x http://gate.proxyfield.io:7000 -U "<login>:<password>" https://api.ipify.org; echo
curl -s -x http://gate.proxyfield.io:7000 -U "<login>:<password>" https://api.ipify.org; echo203.0.113.24
198.51.100.73(Example output: your IPs will differ.) For a list of URLs, run several curl processes in parallel; each request leaves from a new IP, and --retry 3 repeats a request on a timeout or an HTTP 408, 429, 500, 502, 503 or 504, waiting 1 s and then doubling the wait:
export PROXY_AUTH="<login>:<password>"
xargs -P 8 -n 1 sh -c 'curl -sS -x http://gate.proxyfield.io:7000 -U "$PROXY_AUTH" --retry 3 \
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" -H "Accept-Language: en-US,en;q=0.9" \
-o /dev/null -w "%{http_code} %{time_total}s $1\n" "$1"' _ < urls.txtEach line of output is the status code, the time and the URL, so 403 and 429 show at a glance.
When a login or a multi-step flow must keep one IP, add a sticky session to the username: session-<id> names it and ttl-<seconds> sets its length, 30 to 129,600 s (30 s to 36 h). Run this three times and you get the same IP three times:
for i in 1 2 3; do
curl -s -x gate.proxyfield.io:7000 \
-U "<login>-country-us-city-new_york-session-he9f2qga-ttl-600:<password>" https://api.ipify.org; echo
done203.0.113.24
203.0.113.24
203.0.113.24(Example output.) A session set without ttl lasts 20 minutes. An IP that is idle for 120 s gets a new IP, and the IP is held while its exit node is up; if the node drops, the gateway retries once with a new session, so the IP may change, and curl must reconnect. For a new IP per job, change the session id.
Without constant blocks? No gateway promises that: the IP rotates, but headers, the TLS fingerprint and the request rate still decide many blocks (section 11). Measure it on your own target instead. On the Easy Trial (1 GB for $2.95), send 100 requests and count the status codes:
seq 100 | xargs -P 8 -I{} curl -s -o /dev/null -x http://gate.proxyfield.io:7000 -U "$PROXY_AUTH" \
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" -w "%{http_code}\n" "https://example.com/" | sort | uniq -cThe output is one line per status code, the count first and the code second; a high count of 403 or 429 means the target needs slower pacing, browser headers or a real browser.
When one request gets a 403 or 429, retry it from a new IP by changing the session id, and wait longer each time:
url="https://example.com/page"
for attempt in 1 2 3; do
sid=$(openssl rand -hex 4)
code=$(curl -s -o page.html -w "%{http_code}" -x http://gate.proxyfield.io:7000 \
-U "<login>-country-us-session-$sid-ttl-60:<password>" "$url")
echo "attempt $attempt, session $sid: $code"
case "$code" in 403|429) sleep $((attempt * 5)) ;; *) break ;; esac
doneattempt 1, session 8ccc4352: 429
attempt 2, session 5f0da4e4: 429
attempt 3, session c8735652: 200(Example output.) On a server, IP allowlist access drops -U: add the server's IP in your account, then call curl -x http://gate.proxyfield.io:<port> https://api.ipify.org with a port you set up in the dashboard. Without a username, the product, location and session are set per port in the dashboard. A 403 from a Cloudflare-protected site is covered in Cloudflare 403 Forbidden.
3. Pick a country or city
Country and city go in the username. For a New York exit IP:
curl -x gate.proxyfield.io:7000 -U "<login>-country-us-city-new_york:<password>" https://api.ipify.orgTargeting covers country, region (state) and city, and in the US all 50 states. For a sticky session that keeps one IP from 30 s to 36 h (presets 1, 5, 10, 30 min, 1, 3, 6 h), add the session parameter to the username. With IP allowlist access there is no username: the product, location and session are set per port in the dashboard. All username parameters are in the targeting docs.
4. Test a proxy with cURL: IP, country, speed
Request https://api.ipify.org through the proxy: it prints the exit IP, and you should see an IP that is not yours.
curl -x http://gate.proxyfield.io:7000 -U "<login>:<password>" https://api.ipify.orgCheck the exit country and city:
curl -x http://gate.proxyfield.io:7000 -U "<login>-country-us-city-new_york:<password>" https://ipinfo.io/jsonMeasure the response codes and timing with -w:
curl -x http://gate.proxyfield.io:7000 -U "<login>:<password>" -o /dev/null -s -w "%{http_connect} %{http_code} %{time_connect}s %{time_total}s\n" https://example.comYou get the proxy's answer to CONNECT (200 means the tunnel is open), the site's status code, the time to connect to the proxy and the total time. To check a list of proxies, use the proxy checker.
5. How do I make curl use a SOCKS5 proxy with a username and password?
Put socks5h:// and the credentials in the proxy URL; curl sends them with SOCKS5 username/password authentication, which is on by default:
curl -x "socks5h://<login>:<password>@gate.proxyfield.io:7000" https://api.ipify.orgOr keep the credentials out of the URL with --proxy-user:
curl -x socks5h://gate.proxyfield.io:7000 --proxy-user "<login>:<password>" https://api.ipify.orgRead moreShow less
Or use the dedicated options, with --socks5-basic to state the method explicitly:
curl --socks5-hostname gate.proxyfield.io:7000 --socks5-basic --proxy-user "<login>:<password>" https://api.ipify.orgThe man page's other form, --socks5, resolves the hostname on your machine and sends the proxy only the IP:
curl --socks5 gate.proxyfield.io:7000 -U "<login>:<password>" https://api.ipify.orgWith -v it prints SOCKS5 connect to <ip>:443 (locally resolved), and a name your own machine cannot resolve fails before the proxy sees it: curl: (97) Could not resolve host: <name>. Prefer socks5h unless you want local DNS.
Give only the login and curl asks for the password, so it stays out of your shell history and the process list:
curl -x socks5h://gate.proxyfield.io:7000 --proxy-user "<login>" https://api.ipify.orgEnter proxy password for user '<login>':With IP allowlist access there are no credentials to pass: once your IP is on the list in your account, drop --proxy-user and connect to the port you set up in the dashboard for that IP (<port> below):
curl -x socks5h://gate.proxyfield.io:<port> https://api.ipify.orgIn a script, where nobody types a password, feed it to curl as a config line on standard input. curl hides the -U argument from process listings where the system allows it, but the man page warns that it is still visible for a brief moment before it is cleared. printf is built into the shell, so it does not show up in ps at all:
printf 'proxy-user = "<login>:<password>"\n' | curl -K - -x socks5h://gate.proxyfield.io:7000 https://api.ipify.orgcurl runs SOCKS5 as defined in RFC 1928, and the username/password step as defined in RFC 1929. RFC 1929 sends the username and password to the proxy unencrypted, so anyone who can read the network path between you and the proxy can read them; on a network you do not trust, use the IP allowlist instead of a password. With -v, a working handshake shows these lines (curl 8.5.0, local test proxy; the host and port are the ones you pass):
* Connected to gate.proxyfield.io (...) port 7000
* SOCKS5 connect to api.ipify.org:443 (remotely resolved)
* SOCKS5 request granted.A working call prints the exit IP, one line such as 203.0.113.24. What the failures look like:
curl: (97) User was rejected by the SOCKS5 server (1 1).
curl: (7) Failed to connect to gate.proxyfield.io port 7000 after 0 ms: Couldn't connect to servercurl prints the first when a SOCKS5 server answers the RFC 1929 login step with a failure, that is, it rejected the username or password; the second means a wrong host, port or a firewall. URL-encode @ and : in the password only in the socks5h://<login>:<password>@... form; with --proxy-user there is nothing to encode.
| Detail | What curl does |
|---|---|
socks5h:// or --socks5-hostname | The proxy resolves the hostname, so the DNS lookup happens at the proxy's location |
socks5:// or --socks5 | curl resolves the hostname on your machine and sends only the IP; the man page: "resolve the hostname locally" |
| No port in the proxy string | curl uses 1080; always give ProxyField's port, 7000 |
| Special characters in the URL form | URL-encode them (@ → %40, : → %3A); with --proxy-user there is nothing to encode |
--socks5-gssapi | Forces GSS-API (Kerberos) instead of username/password |
Use socks5h. The option semantics are in the curl man page. SOCKS5 takes the same username and password. When to pick SOCKS5 over HTTP is covered on the SOCKS5 proxies page.
6. HTTPS proxy (TLS to the proxy)
An https:// proxy URL encrypts the connection between curl and the proxy itself (curl 7.52.0 or later with OpenSSL or GnuTLS).
ProxyField's examples use http:// and socks5h:// proxy URLs; for TLS to the gateway itself, ask our 24/7 live chat.
You don't need it for HTTPS sites: through an http:// proxy, curl opens a CONNECT tunnel and TLS runs between curl and the site. An https:// proxy also encrypts the CONNECT request and your proxy credentials on the way to the proxy.
7. Use a proxy for every cURL call: environment variables and .curlrc
Run export https_proxy="http://<login>:<password>@gate.proxyfield.io:7000" and the same for http_proxy (lowercase), or put proxy = "http://gate.proxyfield.io:7000" and proxy-user = "<login>:<password>" in ~/.curlrc, and every curl call uses the proxy without -x; -x on one command still overrides both. On a shared machine, keep the password out of exported variables and chmod 600 the file. Then check it: curl -v https://api.ipify.org with no -x must print * Connected to gate.proxyfield.io (...) port 7000 and an IP that is not yours.
Read moreShow less
export https_proxy="http://<login>:<password>@gate.proxyfield.io:7000"
export http_proxy="http://<login>:<password>@gate.proxyfield.io:7000"# ~/.curlrc (_curlrc in %APPDATA% or your home folder on Windows)
proxy = "http://gate.proxyfield.io:7000"
proxy-user = "<login>:<password>"
noproxy = "localhost,127.0.0.1"The same file for SOCKS5:
# ~/.curlrc, SOCKS5 with remote DNS
proxy = "socks5h://gate.proxyfield.io:7000"
proxy-user = "<login>:<password>"The same file with a US exit IP held for 10 minutes: the targeting and the sticky session go in the username, so every curl call leaves from the same IP until the session ends:
# ~/.curlrc, sticky US session
proxy = "http://gate.proxyfield.io:7000"
proxy-user = "<login>-country-us-session-abc123-ttl-600:<password>"Run chmod 600 ~/.curlrc so other users cannot read the password. To use the proxy in one project only, and not for every curl call on the machine, define a shell function instead of a global .curlrc:
export PROXY_AUTH="<login>-country-us:<password>"
pcurl() { curl -x http://gate.proxyfield.io:7000 -U "$PROXY_AUTH" "$@"; }
pcurl -s https://api.ipify.orgpcurl takes every curl option, and plain curl stays direct.
Which file is curl reading? On Linux and macOS it takes the first it finds: $CURL_HOME/.curlrc, then $XDG_CONFIG_HOME/curlrc ("Added in 7.73.0", the man page notes), then ~/.curlrc. To see which proxy a run picked up, add -v. The Windows list is longer and is in the curl man page under -K.
| Setting | What it covers |
|---|---|
| Which wins | -x on the command line (the curl tutorial: "The usage of the -x/--proxy flag overrides the environment variables"), then a proxy line in ~/.curlrc (per the man page's -K, a config file's options count as command-line options), then http_proxy / https_proxy, then ALL_PROXY; with both cases of a variable set, the lowercase one |
http_proxy | http:// URLs; lowercase only (curl ignores HTTP_PROXY) |
https_proxy or HTTPS_PROXY | https:// URLs |
ALL_PROXY or all_proxy | any URL without a protocol-specific variable; use it for SOCKS5 |
NO_PROXY or no_proxy | hosts that go direct: * matches all; example.com also covers www.example.com |
~/.curlrc | curl only, read on every run; -q as the first option skips it, -K file reads another file |
For SOCKS5 on every call:
export ALL_PROXY="socks5h://<login>:<password>@gate.proxyfield.io:7000"In ~/.curlrc, long option names go without the leading dashes, the separator is =, : or a space, and a line that starts with # is a comment. On Linux, add the export lines to ~/.bashrc to keep them in new terminals. On Windows, use set HTTPS_PROXY=http://<login>:<password>@gate.proxyfield.io:7000 in Command Prompt or $env:HTTPS_PROXY="http://<login>:<password>@gate.proxyfield.io:7000" in PowerShell. For system-wide settings on a Mac, see Mac proxy settings. The variables and the config file are described in the curl tutorial.
8. Bypass the proxy: --noproxy and NO_PROXY
--noproxy "*" sends one request directly, ignoring every proxy setting:
curl --noproxy "*" https://example.comA comma-separated list skips it only for those hosts (a domain also matches its subdomains):
curl --noproxy "localhost,127.0.0.1,.internal" https://example.comexport NO_PROXY="localhost,127.0.0.1" does the same for every command in the shell. To ignore a proxy set in the environment for one call, pass an empty proxy:
curl -x "" https://example.comWatch the reverse case: a host on the NO_PROXY list goes direct even when you pass -x. --noproxy overrides the variable (curl man page), so add --noproxy "" to clear the list for that command.
9. Debug a proxy connection
Add -v to any command to see the handshake. A working tunnel looks like this in curl's output (the text after 200 is the proxy's own reason phrase):
* Connected to gate.proxyfield.io (...) port 7000
> CONNECT api.ipify.org:443 HTTP/1.1
< HTTP/1.1 200 Connection established
* CONNECT tunnel established, response 200Read moreShow less
The verbose output also shows the Proxy-Authorization header, your credentials in Base64: remove it before sharing a log.
The messages below are curl's own, the same for any proxy; ProxyField's own gateway responses are in the line under the table.
| Symptom | Likely cause | Fix |
|---|---|---|
curl: (56) CONNECT tunnel failed, response 407 | A proxy answered the CONNECT with HTTP 407 Proxy Authentication Required (the HTTP standard's meaning): it wants credentials it did not accept | Copy <login>:<password> again; URL-encode the password in the URL form |
curl: (5) Could not resolve proxy | A typo in the proxy host | Use gate.proxyfield.io |
curl: (22) The requested URL returned error: 407 (with -f, for an http:// site) | The same HTTP 407 for a plain-HTTP target | As above |
curl: (7) Failed to connect to ... port ... or a timeout | Wrong port or protocol, or a firewall | Use port 7000 and http://; check the firewall |
curl: (35) ... wrong version number with -x https:// | The proxy port does not speak TLS | Use http:// (section 6) |
curl: (97) User was rejected by the SOCKS5 server (1 1). | The SOCKS5 server failed the RFC 1929 login step | Copy <login>:<password> again; URL-encode @ and : in the URL form |
| Wrong country | A misspelled username parameter | Compare with <login>-country-us-city-new_ |
| The request skips the proxy | NO_PROXY or --noproxy matches the host | Run env | grep -i proxy; add --noproxy "" |
| A site category won't load | Some site categories are restricted to protect the network, including financial and government services | See our acceptable use policy |
Gateway responses: 407 Proxy Authentication Required for a wrong login or password, an IP not on the allowlist or a malformed location, 402 Payment Required when no traffic is left and 502 Bad Gateway when no exit could be connected; a restricted site gets no separate response, and a 403 comes from the site itself. See proxy errors.
10. cURL on Windows
In Windows PowerShell 5.1, curl is an alias for Invoke-WebRequest, so type curl.exe to run real curl. Windows 10 (since build 17063, 2018) and Windows 11 include curl.exe (curl.se).
curl.exe -x http://gate.proxyfield.io:7000 -U "<login>:<password>" https://api.ipify.orgSystem-wide settings are covered in Windows proxy settings, and PowerShell's own cmdlets in PowerShell with a proxy.
11. Scraping with cURL without getting blocked
To get blocked less, spread requests over many IPs, send realistic headers and pace requests within the site's rules. The gateway rotates the IP; add the headers yourself:
curl -x http://gate.proxyfield.io:7000 -U "<login>:<password>" -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" -H "Accept-Language: en-US,en;q=0.9" https://example.comcurl's TLS handshake also differs from a browser's, and some sites fingerprint it; curl-impersonate and its Python binding curl_cffi send browser-like handshakes and take the same proxy URL (see TLS and TCP fingerprinting). For plain Python, see Python with a proxy.
A proxy changes your IP, its location and its reputation, and spreading requests over many IPs cuts per-IP rate-limit blocks. It does not solve CAPTCHAs or change curl's TLS signature or a headless browser's fingerprint. For pages that need JavaScript, switch to a real browser: Playwright, Selenium or Puppeteer.
Use ProxyField for lawful work such as public web data collection, price and SEO monitoring, ad verification and testing, within our acceptable use policy. For per-request IPs at scale, see rotating proxies.
Get started
Start with the Easy Trial: 1 GB for $2.95, no minimum purchase, no subscription; the traffic never expires and all purchases are final. See pricing per GB for residential proxies and mobile 5G/4G proxies.
When cURL is the right scraper, and when a browser is, is covered in how to scrape a website.
cURL with Proxy FAQ
How do I test a residential proxy with curl from the command line?
ProxyField residential proxies test with one command, from $1.95/GB: curl -x http://gate.proxyfield.io:7000 -U "<login>-country-us-city-new_york:<password>" https://ipinfo.io/json prints the exit IP and its country and city. Run https://api.ipify.org twice to see the rotation, and add -w "%{http_code} %{time_total}s\n" to time it.
How do I make curl use a SOCKS5 proxy with a username and password?
Run curl -x socks5h://gate.proxyfield.io:7000 --proxy-user "<login>:<password>" https://api.ipify.org, put the credentials in the URL as socks5h://<login>:<password>@gate.proxyfield.io:7000, or use --socks5 gate.proxyfield.io:7000 -U "<login>:<password>", which resolves the hostname locally; SOCKS5 username/password authentication (RFC 1929) is on by default, and the h makes the proxy resolve the hostname. Give --proxy-user "<login>" alone and curl prompts for the password, which keeps it out of your shell history. A rejected login makes curl print curl: (97) User was rejected by the SOCKS5 server (1 1).; RFC 1929 sends the login to the proxy unencrypted, so use the IP allowlist, with the port you set up in the dashboard, on a network you do not trust.
Which proxy providers offer a rotating residential gateway that works well with curl scripts?
ProxyField does: one endpoint, gate.proxyfield.io:7000, gives a new residential IP on every request, with sticky sessions of 30 s to 36 h (-session-<id>-ttl-<seconds> in the username) and unlimited concurrent threads, from $1.95/GB ($2.95 at 1 GB, no subscription, traffic never expires). Whichever provider you pick, check for a single gateway, username:password that fits -U, per-request rotation and per-GB billing. Headers, TLS fingerprint and request rate still decide many blocks.
How do I make curl use a proxy for every call through environment variables or a .curlrc file?
Export https_proxy and http_proxy (or ALL_PROXY for SOCKS5) in the shell, or add proxy = "http://gate.proxyfield.io:7000" and proxy-user = "<login>:<password>" to ~/.curlrc. -x on the command line beats ~/.curlrc, which beats the variables, and http_proxy works only in lowercase; curl reads $CURL_HOME/.curlrc first if it exists. Run curl -v https://api.ipify.org with no -x and look for Connected to gate.proxyfield.io and port 7000 to confirm.
How do I use cURL with a proxy?
Run curl -x http://host:port -U "user:pass" URL. With ProxyField: curl -x http://gate.proxyfield.io:7000 -U "<login>:<password>" https://api.ipify.org.
How do I use a proxy with curl on Linux?
Pass -x and -U on each command, or export https_proxy="http://<login>:<password>@gate.proxyfield.io:7000" (and http_proxy) in the shell. Add the export lines to ~/.bashrc to keep them in new terminals.
How do I set a proxy for curl in Ubuntu?
The same as on any Linux: -x per command, https_proxy and http_proxy in ~/.bashrc for your user, or proxy and proxy-user lines in ~/.curlrc for curl alone. apt and other tools read their own settings.
How do I set a permanent proxy for curl?
Put proxy = "http://gate.proxyfield.io:7000" and proxy-user = "<login>:<password>" in ~/.curlrc (_curlrc on Windows). curl reads it on every run; -q as the first option skips it.
Why is curl ignoring my proxy settings?
Usually the host is on NO_PROXY, HTTP_PROXY is set in uppercase, or -q or a .curlrc changes the setup. Run env | grep -i proxy, then pass -x explicitly and add --noproxy "" to clear the exception list for that command.
How do I check if curl is using a proxy?
Add -v: the output shows Connected to gate.proxyfield.io and the CONNECT line when the proxy is in use. Requesting https://api.ipify.org shows the exit IP, which should not be yours.
Show 15 more questionsShow fewer questions
How do I authenticate a proxy in curl?
Pass -U "<login>:<password>" (--proxy-user), or put the credentials in the proxy URL as http://<login>:<password>@host:port. In the URL form, encode special characters: p@ss:word becomes p%40ss%3Aword.
What's the difference between -x and -U in curl?
-x sets the proxy's address and -U its username and password. Lowercase -u sends credentials to the target site, not the proxy.
What proxy types does curl support?
HTTP and HTTPS proxies, and SOCKS4, SOCKS4a, SOCKS5 and SOCKS5h, chosen by the scheme in the -x URL. ProxyField's gateway speaks HTTP, HTTPS and SOCKS5.
What is the difference between socks5 and socks5h in curl?
With socks5h://, the proxy resolves the hostname; with socks5://, curl resolves it on your machine and sends only the IP. Use socks5h so the lookup happens at the proxy's location.
How do I use an HTTPS proxy with curl?
An https:// proxy URL encrypts the link between curl and the proxy itself (curl 7.52.0 or later). You don't need it for HTTPS sites: through an http:// proxy, curl opens a CONNECT tunnel and TLS runs end to end with the site.
How do I bypass a proxy in a curl command?
Add --noproxy "*" to skip the proxy for every host, or --noproxy "host1,host2" for a list. NO_PROXY does the same for every command in the shell.
How do I rotate proxies with curl?
Send every command to the gateway: ProxyField gives a new IP on every request, so you need no proxy list. For one IP across several commands, use a sticky session of 30 s to 36 h in the username.
How do I troubleshoot curl proxy errors?
Add -v and read curl's message: (56) CONNECT tunnel failed, response 407 means the proxy wants credentials it did not accept, (5) Could not resolve proxy a typo in the host, (7) Failed to connect the wrong port or a firewall, (97) a SOCKS5 login the server rejected. The full table is in section 9.
What does curl error 56 "Proxy CONNECT aborted" mean?
The proxy closed the connection during the CONNECT handshake, so the tunnel to the site never opened. Check the credentials and the protocol on the port with -v, then try the target without the proxy.
How do I use cURL with a proxy in PHP?
Set curl_setopt($ch, CURLOPT_PROXY, 'http://gate.proxyfield.io:7000') and curl_setopt($ch, CURLOPT_PROXYUSERPWD, '<login>:<password>'). For SOCKS5, add curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME).
How do I call an API using a proxy?
Add -x and -U to the API request you already have, for example curl -x http://gate.proxyfield.io:7000 -U "<login>:<password>" -H "Accept: application/json" https://api.example.com/items. Pick a sticky session if the API ties a token to one IP.
Why use a proxy with curl?
To see a page or an API as a visitor from another country or city sees it, and to spread many requests over many IPs, which cuts per-IP rate-limit blocks. curl makes it quick to test both from a script.
How do I avoid getting blocked when scraping with curl?
Rotate IPs, send realistic headers, pace requests within the site's rules, and use a browser-like TLS handshake where sites check it. --retry 3 repeats a request after a 429 or a 5xx with a growing wait. Proxies alone don't change fingerprints; for JavaScript pages, use a real browser.
What is the default port of a curl proxy?
If the proxy string has no port, curl uses 1080. Always give ProxyField's port explicitly: gate.proxyfield.io:7000.
What proxy format does curl accept?
scheme://[user:pass@]host:port, where the scheme is http, https, socks4, socks4a, socks5 or socks5h. Without a scheme, curl assumes an HTTP proxy.