coreproxies.com
cURLIntegration guide

cURL proxy commands

cURL is the fastest way to prove that a proxy works before you write any code. Two options do most of the work: -x for the proxy address and -U for the login.

Last updated:

Connection fields

Each of the four dashboard values has a place on the command line.

The dashboard shows HOST:PORT:USERNAME:PASSWORD. cURL takes them in two options:

  • -x (long form --proxy): scheme, host and port, for example -x http://HOST:PORT.
  • -U (long form --proxy-user): USERNAME:PASSWORD, in quotes.

You can also write everything in one URL, -x "http://USERNAME:PASSWORD@HOST:PORT". The separate -U form is easier when the password contains characters that would need encoding inside a URL. Do not confuse -U with lowercase -u, which sends a login to the target site instead of the proxy. Quote any URL that contains ? or & so the shell does not interpret it.

ProductHost and portProtocolsAuthentication
Residential and Unlimited Residentialshown in your dashboardHTTP, HTTPS and SOCKS5 on the same portusername:password
Rotating Mobileshown in your dashboardHTTP(S) and SOCKS5 on the same portusername:password
Mobile Proxy (Reset Link)shown in your dashboardHTTP(S) and SOCKS5 on the same portusername:password
Datacenter, ISP and IPv6shown with your order in the dashboardHTTP(S) and SOCKS5 on separate portsusername:password

HOST, PORT, USERNAME and PASSWORD in the examples are placeholders. Your dashboard shows the host, port, username and password for each plan: copy them from the Proxy generator.

HTTP(S) or SOCKS5

The scheme in front of the proxy address selects the protocol.

ProtocolResidential and mobile plansDatacenter, ISP and IPv6In cURL
HTTP(S)host and port from your dashboardHTTP(S) port shown with your order-x http://HOST:PORT
SOCKS5same host and portSOCKS5 port shown with your order-x socks5h://HOST:PORT or --socks5-hostname HOST:PORT

With no scheme, cURL assumes an HTTP proxy. For SOCKS5, prefer socks5h://: the proxy then resolves the target hostname. Plain socks5:// resolves it locally first and sends only the IP through the proxy.

# SOCKS5: socks5h lets the proxy resolve the hostname.
# HOST, PORT, USERNAME and PASSWORD come from your dashboard (Proxy generator).
curl -x "socks5h://USERNAME:PASSWORD@HOST:PORT" \
  "https://api.ipify.org?format=json"

# The same request with separate options
curl --socks5-hostname HOST:PORT \
  -U "USERNAME:PASSWORD" \
  "https://api.ipify.org?format=json"

On Residential and mobile plans SOCKS5 uses the same host and port as HTTP(S); Datacenter, ISP and IPv6 orders show a separate SOCKS5 port.

Authentication example

The same request written two ways: separate options, and one proxy URL.

# Replace HOST, PORT, USERNAME and PASSWORD with the values
# from your dashboard (Proxy generator).
curl -x http://HOST:PORT \
  -U "USERNAME:PASSWORD" \
  "https://api.ipify.org?format=json"

# The same request with the credentials inside the proxy URL
curl -x "http://USERNAME:PASSWORD@HOST:PORT" \
  "https://api.ipify.org?format=json"

Replace HOST, PORT, USERNAME and PASSWORD with the values from your dashboard; copy them from the Proxy generator. The backslash at the end of a line continues the command in bash and zsh. In Windows PowerShell, call curl.exe and write the command on one line; plain curl can be an alias for a different command there.

To avoid repeating the options, export the proxy once per shell. cURL reads the lowercase http_proxy and https_proxy variables:

# Copy HOST, PORT, USERNAME and PASSWORD from your dashboard (Proxy generator).
# Set the proxy once for every curl call in this shell
export http_proxy="http://USERNAME:PASSWORD@HOST:PORT"
export https_proxy="$http_proxy"

curl "https://api.ipify.org?format=json"

# Skip the proxy for one call
curl --noproxy "*" "https://api.ipify.org?format=json"

Rotation and sticky sessions

Only the username changes between a rotating request and a sticky one.

Run the first loop on a Residential plan and you should normally see a new address on each pass: every curl call opens a new connection, and the plain username rotates on each new connection. An address can repeat now and then. The second loop adds a session number and a ttl, and prints one address three times.

# Residential plan: copy HOST, PORT, USERNAME and PASSWORD from your dashboard (Proxy generator).

# Rotating: no session in the username. Each run opens a new connection,
# so you normally see a new IP each time (an address can repeat now and then).
for i in 1 2 3; do
  curl -s -x http://HOST:PORT \
    -U "USERNAME:PASSWORD" \
    "https://api.ipify.org"
  echo
done

# Sticky session: the same IP for 600 seconds
for i in 1 2 3; do
  curl -s -x http://HOST:PORT \
    -U "USERNAME-session-482913-ttl-600:PASSWORD" \
    "https://api.ipify.org"
  echo
done

Pick any six-digit number as the session number and keep it for as long as you want that IP; a different number gives a different session.

ProductNew IPSame IPLocation
Residential and Unlimited ResidentialUSERNAME (every new connection)USERNAME-session-482913-ttl-600USERNAME-country-de
Rotating MobileUSERNAME (every new connection)USERNAME-session-482913-ttl-600chosen in your dashboard
Mobile Proxy (Reset Link)Change IP button or reset linkUSERNAME keeps one IP for up to 24 hourschosen in your dashboard
Datacenter, ISP and IPv6set in the Proxy generatorset in the Proxy generatorset in the Proxy generator

On Residential and Unlimited Residential the username on its own rotates, so every new connection gets a new IP. For a sticky session add -session- with a number and -ttl- with the time in seconds. Sticky sessions last up to 24 hours; the dashboard offers 1 minute, 10 minutes, 30 minutes, 1 hour, 6 hours and 24 hours, or a custom time. Use a different session number for each account or task; a new number gives you a new IP. On Datacenter, ISP and IPv6, the Proxy generator of your order builds the username for you: copy the generated lines from there. Details are in the rotating proxies guide.

For IPs from one country on Residential or Unlimited Residential, add -country- and a two-letter country code to the username, for example USERNAME-country-de. State and city are chosen in the Proxy generator, which adds them to the username for you. Location and session combine as USERNAME-country-de-session-482913-ttl-600:

# Residential and Unlimited Residential: copy HOST, PORT, USERNAME and PASSWORD
# from your dashboard (Proxy generator).

# IPs from Germany, a new one for every connection
curl -x http://HOST:PORT \
  -U "USERNAME-country-de:PASSWORD" \
  "https://api.ipify.org?format=json"

# Country and sticky session combined: one IP from Germany for 600 seconds
curl -x http://HOST:PORT \
  -U "USERNAME-country-de-session-482913-ttl-600:PASSWORD" \
  "https://api.ipify.org?format=json"

Rotating Mobile uses the same commands with the host and port of its plan. The location is chosen in your dashboard, so the username carries only the session:

# Rotating Mobile: copy HOST, PORT, USERNAME and PASSWORD from your dashboard (Proxy generator).
# The country is chosen in the dashboard, not in the username.

# No session: every new connection gets a new carrier IP
curl -x http://USERNAME:PASSWORD@HOST:PORT https://api.ipify.org

# Sticky session: pick your own number (digits only); ttl is in seconds
curl -x http://USERNAME-session-482913-ttl-600:PASSWORD@HOST:PORT https://api.ipify.org

# SOCKS5 on the same host and port
curl -x socks5h://USERNAME:PASSWORD@HOST:PORT https://api.ipify.org

On Rotating Mobile you choose All countries or a single country in your dashboard, and the carrier inside that country is picked automatically. The username carries only the session: without one, every new connection gets a new carrier IP.

On Rotating Mobile the session ID must be numbers only (digits 0–9); an ID with letters is ignored and the IP keeps rotating. The number is only an example: pick your own, such as a random 6-digit number, and use a different one for each account or task. The ttl value is how long you want to keep the IP, in seconds. Mobile networks can still change an IP on their own, so plan for an occasional change.

Mobile Proxy (Reset Link) keeps one carrier IP for up to 24 hours. Change it with the Change IP button or your reset link, once every 30 seconds; changing the location in your dashboard also gives you a new IP.

Test the connection

One command is enough to see which address a target would see.

https://api.ipify.org answers with the IP the request came from. Run it once without -x and once with: the outputs should differ. The browser equivalent is the My IP tool, which shows the address of whatever connection the browser is using.

When something fails, add -v, or print only the two status codes that matter:

# Copy HOST, PORT, USERNAME and PASSWORD from your dashboard (Proxy generator).
# Verbose output shows the CONNECT request and the proxy's answer
curl -v -x http://HOST:PORT \
  -U "USERNAME:PASSWORD" \
  "https://api.ipify.org?format=json"

# Print only the status codes: proxy answer to CONNECT, then the target's answer
curl -s -o /dev/null \
  --connect-timeout 10 --max-time 30 \
  -w "proxy: %{http_connect}  target: %{http_code}\n" \
  -x http://HOST:PORT \
  -U "USERNAME:PASSWORD" \
  "https://api.ipify.org?format=json"

In verbose output, lines starting with > are what cURL sent and lines starting with < are what came back. The first exchange is the CONNECT to the proxy; the proxy's reply to it is where a login problem shows.

Troubleshooting

cURL names the failing step in its error text and exit code.

407 Proxy Authentication Required

The message reads "CONNECT tunnel failed, response 407" and %{http_connect} prints 407. Check that you used uppercase -U, that the username and its suffix are spelled as in the Proxy generator, and that the string is quoted. Confirm the credentials belong to the plan whose host follows -x.

Timeouts and connection errors

Exit code 7 (failed to connect) or 28 (timed out) before any proxy reply means the proxy was not reached: check the host, the port and outbound firewall rules for the proxy port. Exit code 5 means the proxy hostname did not resolve. On Datacenter, ISP and IPv6, where HTTP(S) and SOCKS5 have separate ports, using a SOCKS5 scheme on the HTTP port, or the reverse, ends in a handshake error. Set --connect-timeout and --max-time so a stalled request ends on its own.

Target ports by plan

On Residential and Unlimited Residential plans, residential IPs connect to websites on ports 80 and 443 only: a URL that names another port, such as :8443, fails even when the proxy login is correct.

All target ports are open on Rotating Mobile and Mobile Proxy (Reset Link) plans.

cURL proxy setup: frequently asked questions

What is the difference between -x and -U in cURL?

-x (--proxy) sets the proxy address: scheme, host and port. -U (--proxy-user) sets the proxy login as USERNAME:PASSWORD.

What is the difference between socks5:// and socks5h://?

With socks5h:// the proxy resolves the target hostname. With socks5:// cURL resolves it on your machine and sends the IP, so the DNS lookup does not go through the proxy.

How do I set a proxy for every cURL command?

Export http_proxy and https_proxy in your shell with the full proxy URL. Use --noproxy "*" to skip the proxy for a single call.

How do I see why a cURL proxy request failed?

Add -v to print the CONNECT exchange with the proxy, or use -w with %{http_connect} and %{http_code} to print the proxy and target status codes.

Can I use these commands on Windows?

Yes. Windows 10 and 11 include curl.exe. In PowerShell, call curl.exe by name and keep each command on one line.

Get started

Test Core Proxies from the command line

Create an account, choose your proxy type and plan, and copy the host, port, username and password from your dashboard. Activation is automatic after payment.

  • Rotating and sticky sessions
  • HTTP(S) and SOCKS5
  • 24/7 support by email
Plans to start withDatacenter and ISP
Datacenterfrom €15 / month · 250 GB · 100 IPsSee pricing
ISPfrom €18.23 / 250 GB + €0.23 / IPSee pricing

Prices exclude VAT