Why use cURL with proxies?

cURL is the most widely used command-line tool for HTTP requests. It's perfect for testing proxy configurations, quick data retrieval, and shell scripting. DataSea proxies work seamlessly with cURL's built-in proxy support.

Prerequisites

  • cURL installed on your system
  • Terminal/command line access
  • DataSea account with proxy credentials

Setup guide

  1. 01

    Get your DataSea credentials

    Sign in to your DataSea dashboard and copy your proxy credentials.

    text
    # DataSea Proxy Configuration
    Proxy Host: pr.datasea.io
    HTTP Port: 7011 (for http:// and https:// websites)
    HTTPS-to-proxy Port: 7010 (TLS between your client and the proxy)
    
    # Your credentials
    Username: your_proxy_username
    Password: your_16_char_password
    
    # Proxy URL format
    http://username:password@pr.datasea.io:7011
  2. 02

    Basic proxy request

    Make your first request through DataSea proxy.

    bash
    # Basic proxy request
    curl -x "http://username:password@pr.datasea.io:7011" \
         https://api.ipify.org?format=json
    
    # Output: {"ip":"xxx.xxx.xxx.xxx"}
  3. 03

    Verify proxy connection

    Check that your requests are going through the proxy.

    bash
    # Check your proxy IP
    curl -x "http://username:password@pr.datasea.io:7011" \
         https://httpbin.org/ip
    
    # Verbose output to debug connection
    curl -v -x "http://username:password@pr.datasea.io:7011" \
         https://httpbin.org/ip
  4. 04

    Country targeting

    Target specific countries by adding parameters to your username.

    bash
    # Target US proxies
    curl -x "http://username_country-UnitedStates:password@pr.datasea.io:7011" \
         https://httpbin.org/ip
    
    # Target UK proxies
    curl -x "http://username_country-GB:password@pr.datasea.io:7011" \
         https://httpbin.org/ip
    
    # Target Germany
    curl -x "http://username_country-DE:password@pr.datasea.io:7011" \
         https://httpbin.org/ip

Key features

Global coverage

Access 195+ countries with residential, datacenter, ISP, and mobile proxies.

Instant rotation

Each request gets a new IP, or use sessions for consistent IPs.

Zero setup

Works immediately with cURL's built-in proxy support.

Simple authentication

Username:password format works out of the box.

Shell scripting

Easy to integrate into bash scripts and automation.

Quick testing

Perfect for testing and debugging proxy configurations.

Common use cases

Basic GET request

Make a simple GET request through the proxy.

bash
# Simple GET request
curl -x "http://username:password@pr.datasea.io:7011" \
     https://example.com

# With custom headers
curl -x "http://username:password@pr.datasea.io:7011" \
     -H "User-Agent: Mozilla/5.0" \
     -H "Accept: application/json" \
     https://api.example.com/data

# Follow redirects
curl -L -x "http://username:password@pr.datasea.io:7011" \
     https://example.com/redirect

POST request with data

Send POST requests through the proxy.

bash
# POST with form data
curl -x "http://username:password@pr.datasea.io:7011" \
     -X POST \
     -d "name=John&email=john@example.com" \
     https://httpbin.org/post

# POST with JSON
curl -x "http://username:password@pr.datasea.io:7011" \
     -X POST \
     -H "Content-Type: application/json" \
     -d '{"name":"John","email":"john@example.com"}' \
     https://httpbin.org/post

Geo-targeted requests

Access content from different countries.

bash
# Create a function for geo-targeted requests
geo_curl() {
  local country=$1
  local url=$2
  curl -s -x "http://username_country-${country}:password@pr.datasea.io:7011" "$url"
}

# Test from different countries
geo_curl US "https://httpbin.org/ip"
geo_curl GB "https://httpbin.org/ip"
geo_curl DE "https://httpbin.org/ip"
geo_curl JP "https://httpbin.org/ip"

# Loop through countries
for country in US GB DE FR JP AU; do
  echo "=== $country ==="
  curl -s -x "http://username_country-${country}:password@pr.datasea.io:7011" \
       https://httpbin.org/ip
done

Sticky sessions

Maintain the same IP across multiple requests.

bash
# Create a session ID (1-32 letters or digits)
SESSION_ID="s$(date +%s)"

# All requests with this session use the same IP
curl -x "http://username_session-${SESSION_ID}:password@pr.datasea.io:7011" \
     https://httpbin.org/ip

curl -x "http://username_session-${SESSION_ID}:password@pr.datasea.io:7011" \
     https://httpbin.org/ip

# Combine country + session
curl -x "http://username_country-UnitedStates_session-${SESSION_ID}:password@pr.datasea.io:7011" \
     https://httpbin.org/ip

Shell script for bulk requests

Automate multiple requests with a shell script.

bash
#!/bin/bash

# proxy_scrape.sh - Bulk scraping with DataSea proxies

PROXY_USER="username"
PROXY_PASS="password"

# URLs to scrape (one per line in a file)
cat > urls.txt << EOF
https://example.com/page1
https://example.com/page2
https://example.com/page3
EOF

# Output directory
mkdir -p output

# Loop through URLs
count=0
while read -r url; do
  output_file="output/page_${count}.html"

  echo "Fetching: $url"

  curl -s -x "http://${PROXY_USER}:${PROXY_PASS}@pr.datasea.io:7011" \
       -o "$output_file" \
       "$url"

  echo "Saved to: $output_file"
  count=$((count + 1))

  # Add delay between requests
  sleep 1
done < urls.txt

echo "Done! Scraped $count pages"

Environment variables for security

Store credentials securely in environment variables.

bash
# Set environment variables (add to ~/.bashrc or ~/.zshrc)
export DATASEA_USER="your_username"
export DATASEA_PASS="your_password"

# Use in curl commands
curl -x "http://${DATASEA_USER}:${DATASEA_PASS}@pr.datasea.io:7011" \
     https://httpbin.org/ip

# Or create an alias
alias pcurl='curl -x "http://${DATASEA_USER}:${DATASEA_PASS}@pr.datasea.io:7011"'

# Then simply use:
pcurl https://httpbin.org/ip

# With country targeting
alias pcurl_us='curl -x "http://${DATASEA_USER}_country-UnitedStates:${DATASEA_PASS}@pr.datasea.io:7011"'
pcurl_us https://httpbin.org/ip

Troubleshooting

Connection Refused

Solution: Verify you're using the correct port (7011) and proxy hostname.

bash
# Correct format
curl -x "http://username:password@pr.datasea.io:7011" https://example.com

# Common mistakes:
# WRONG: pr.datasea.io:80
# WRONG: pr.datasea.io:443
# WRONG: proxy.datasea.io:7011
# CORRECT: pr.datasea.io:7011

407 Proxy Authentication Required

Solution: Check your username and password are correct.

bash
# Verify credentials format
# Username: your_username (from dashboard)
# Password: 16-character alphanumeric (from dashboard)

# Test with verbose output
curl -v -x "http://username:password@pr.datasea.io:7011" \
     https://httpbin.org/ip

# URL-encode special characters in password if needed
# @ becomes %40
# : becomes %3A

SSL Certificate Errors

Solution: The proxy handles SSL. If issues persist, try the -k flag for testing.

bash
# Skip SSL verification (for testing only)
curl -k -x "http://username:password@pr.datasea.io:7011" \
     https://example.com

# Better: Update CA certificates
# On Ubuntu/Debian:
sudo apt-get update && sudo apt-get install ca-certificates

# On macOS:
brew install ca-certificates

Timeout Errors

Solution: Increase timeout values for slow responses.

bash
# Set connection timeout (seconds)
curl --connect-timeout 30 \
     -x "http://username:password@pr.datasea.io:7011" \
     https://example.com

# Set maximum time for entire operation
curl --max-time 60 \
     -x "http://username:password@pr.datasea.io:7011" \
     https://example.com

# Both timeouts
curl --connect-timeout 30 --max-time 120 \
     -x "http://username:password@pr.datasea.io:7011" \
     https://slow-website.com

Get started with industry‑leading proxy access

Connect to 150M+ real IPs in seconds. Built for scale, privacy, and performance. Free trial available.