Home/Blog/Mobile Proxy with cURL
Developer Guide

Mobile Proxy with cURL & wget

The fastest way to test a mobile proxy is from the shell. curl -x tunnels a single request, --socks5 switches transport, and http_proxy env vars make every CLI tool route through the proxy. This guide covers all of it, plus rotation.

6 min read·CLI·Last updated: May 2026

Prerequisites

  • curl (7.x+) and wget installed (curl --version).
  • A mobile proxy slot, HTTP/SOCKS5 ports, username, password and API key from mobileproxies.org.
  • A POSIX shell (bash/zsh) for the env-var examples.

Step-by-Step Configuration

STEP 01

Export credentials

# Keep secrets out of shell history; source a .env if you prefer
export MP_HOST=proxy.mobileproxies.org
export MP_HTTP_PORT=8000
export MP_SOCKS_PORT=1080
export MP_USER=u_4a9c
export MP_PASS=p_2X7q
export MP_API_KEY=YOUR_API_KEY
export MP_SLOT=us-mob-01
STEP 02

curl over HTTP (-x and -U)

# Credentials embedded in the proxy URL
curl -x "http://$MP_USER:$MP_PASS@$MP_HOST:$MP_HTTP_PORT" \
     https://example.com

# Or keep them separate with -U / --proxy-user
curl --proxy "http://$MP_HOST:$MP_HTTP_PORT" \
     -U "$MP_USER:$MP_PASS" \
     https://example.com
STEP 03

curl over SOCKS5

# --socks5 resolves DNS locally; --socks5-hostname resolves
# on the proxy (preferred, avoids DNS leaks)
curl --socks5-hostname "$MP_USER:$MP_PASS@$MP_HOST:$MP_SOCKS_PORT" \
     https://example.com
STEP 04

wget and environment variables

# wget — explicit proxy + credentials
wget -e use_proxy=yes \
     -e http_proxy="http://$MP_HOST:$MP_HTTP_PORT" \
     -e https_proxy="http://$MP_HOST:$MP_HTTP_PORT" \
     --proxy-user="$MP_USER" \
     --proxy-password="$MP_PASS" \
     -O page.html https://example.com

# Or set env vars once — curl, wget, git and most tools honor these
export HTTP_PROXY="http://$MP_USER:$MP_PASS@$MP_HOST:$MP_HTTP_PORT"
export HTTPS_PROXY="$HTTP_PROXY"
curl https://example.com      # now goes through the proxy
wget -O - https://example.com # so does wget

Verify It Works

Ask api.ipify.org for the egress IP through the proxy. It should be a carrier-owned mobile IP, never your machine's real address.

curl -s -x "http://$MP_USER:$MP_PASS@$MP_HOST:$MP_HTTP_PORT" \
     https://api.ipify.org
# -> 100.42.x.x  (a mobile ASN, not your home/office IP)

Rotate the IP

Request a fresh carrier IP with a POST to the switch endpoint. This call goes direct (no -x) and authenticates with your API key. Then re-check the egress IP:

# Trigger a rotation
curl -s -X POST \
     -H "Authorization: Bearer $MP_API_KEY" \
     "https://buy.mobileproxies.org/api/v1/proxies/$MP_SLOT/switch"

sleep 4 # let the new IP bind

# Confirm the IP changed
curl -s -x "http://$MP_USER:$MP_PASS@$MP_HOST:$MP_HTTP_PORT" \
     https://api.ipify.org

To list your slots: curl -H "Authorization: Bearer $MP_API_KEY" https://buy.mobileproxies.org/api/v1/proxies

Troubleshooting

curl: (56) Received HTTP code 407 from proxy

Bad or missing credentials. Double-check the user:pass in the -x URL, or pass them with -U. A special character in the password may need percent-encoding (@%40).

Requests ignore your env vars

curl reads lowercase http_proxy/https_proxy and uppercase HTTPS_PROXY. Set both cases to be safe, and clear NO_PROXY if your target host is listed there.

SOCKS5 leaks DNS

Use --socks5-hostname rather than --socks5 so the target hostname is resolved on the proxy side instead of your local resolver.

Related Guides

Test Mobile IPs From Your Shell

$5 trial. One curl -x and you're on a carrier IP — rotate on the API when you need a new one.