cURL Integration

cURL Proxy SetupCommand-line HTTP with mobile IPs

cURL is the universal tool for testing APIs and downloading data. Configure SOCKS5 and HTTP proxies for quick testing and scripting.

Quick Test

curl --proxy socks5://user:pass@proxy.proxies.sx:10001 \
     https://httpbin.org/ip

Configuration Examples

1. SOCKS5 Proxy

# Basic SOCKS5 with authentication
curl --proxy socks5://your_username:your_password@proxy.proxies.sx:10001 \
     https://httpbin.org/ip

# Short form
curl -x socks5://user:pass@proxy.proxies.sx:10001 https://httpbin.org/ip

# SOCKS5h (DNS through proxy - recommended)
curl --proxy socks5h://user:pass@proxy.proxies.sx:10001 https://httpbin.org/ip

2. HTTP Proxy

# HTTP proxy
curl --proxy http://your_username:your_password@proxy.proxies.sx:10001 \
     https://httpbin.org/ip

# Separate user/pass flags
curl --proxy http://proxy.proxies.sx:10001 \
     --proxy-user your_username:your_password \
     https://httpbin.org/ip

# Using environment variable
export http_proxy="http://user:pass@proxy.proxies.sx:10001"
export https_proxy="http://user:pass@proxy.proxies.sx:10001"
curl https://httpbin.org/ip

3. Common Options

# With timeout
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     --connect-timeout 10 \
     --max-time 30 \
     https://httpbin.org/ip

# Follow redirects
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -L \
     https://example.com/redirect

# Verbose output (for debugging)
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -v \
     https://httpbin.org/ip

# Silent mode (suppress progress)
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -s \
     https://httpbin.org/ip

4. Custom Headers

# Custom User-Agent
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0" \
     https://httpbin.org/headers

# Multiple headers
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -H "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_0)" \
     -H "Accept: application/json" \
     -H "Accept-Language: en-US,en;q=0.9" \
     https://httpbin.org/headers

5. POST Requests

# Form data
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -X POST \
     -d "username=test&password=secret" \
     https://httpbin.org/post

# JSON data
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -X POST \
     -H "Content-Type: application/json" \
     -d '{"key": "value"}' \
     https://httpbin.org/post

# File upload
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -X POST \
     -F "file=@/path/to/file.txt" \
     https://httpbin.org/post

6. Download Files

# Save to file
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -o output.html \
     https://example.com

# Use remote filename
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -O \
     https://example.com/file.pdf

# Resume download
curl -x socks5h://user:pass@proxy.proxies.sx:10001 \
     -C - \
     -O \
     https://example.com/large-file.zip

7. Bash Script with Rotation

#!/bin/bash

# Proxy configuration
PROXY_USER="your_username"
PROXY_PASS="your_password"
PROXY_HOST="proxy.proxies.sx"
PORTS=(10001 10002 10003 10004 10005)

# Function to get random proxy
get_proxy() {
    local idx=$((RANDOM % ${#PORTS[@]}))
    echo "socks5h://$PROXY_USER:$PROXY_PASS@$PROXY_HOST:${PORTS[$idx]}"
}

# URLs to scrape
URLS=(
    "https://httpbin.org/ip"
    "https://httpbin.org/headers"
    "https://httpbin.org/user-agent"
)

# Scrape each URL with a different proxy
for url in "${URLS[@]}"; do
    proxy=$(get_proxy)
    echo "Fetching $url via ${proxy##*@}"
    curl -s -x "$proxy" "$url" | head -c 200
    echo -e "\n---"
done

8. Config File (.curlrc)

# ~/.curlrc - Default cURL options

# Proxy settings
proxy = "socks5h://your_username:your_password@proxy.proxies.sx:10001"

# Timeouts
connect-timeout = 10
max-time = 30

# Follow redirects
location

# Custom User-Agent
user-agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0"

# Silent progress
silent

# Now just run: curl https://httpbin.org/ip
# Proxy is applied automatically
Pro Tip: Use socks5h:// instead of socks5:// to resolve DNS through the proxy. This prevents DNS leaks that could reveal your real location.

Quick Reference

OptionDescriptionExample
-x, --proxySet proxy-x socks5h://user:pass@host:port
--proxy-userProxy credentials--proxy-user user:pass
-LFollow redirects-L
-sSilent mode-s
-vVerbose (debug)-v
-oOutput to file-o output.html
-HCustom header-H "User-Agent: ..."
--connect-timeoutConnection timeout--connect-timeout 10

cURL Proxy Best Practices

Use socks5h://

The 'h' suffix routes DNS through the proxy, preventing DNS leaks and enabling access to region-specific domains.

Set Timeouts

Always use --connect-timeout and --max-time to prevent hanging on slow or unreachable targets.

Quote Passwords

If your password contains special characters, wrap it in quotes or URL-encode it to avoid shell issues.

Use -v for Debugging

The verbose flag shows connection details including proxy handshake. Essential for troubleshooting.

Test Your Setup with cURL

Get mobile proxies and verify your connection in seconds.