cURL Integration
cURL is a powerful command-line tool for making HTTP requests. This guide shows how to use WeProxies with cURL.
Basic Usage
HTTP Proxy
curl -x "http://wp_user123:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
Country Targeting
# United States
curl -x "http://wp_user123-country-US:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
# United Kingdom
curl -x "http://wp_user123-country-GB:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
# Germany
curl -x "http://wp_user123-country-DE:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
# Japan
curl -x "http://wp_user123-country-JP:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
Sticky Sessions
# Same session ID = same IP
curl -x "http://wp_user123-session-mysession:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
# Country + session
curl -x "http://wp_user123-country-US-session-abc123:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
Common Options
Verbose Output (Debugging)
curl -v -x "http://wp_user123:password@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
Custom Headers
curl -x "http://wp_user123:password@proxy.weproxies.com:1080" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
-H "Accept-Language: en-US,en;q=0.9" \
https://example.com
Timeout
curl -x "http://wp_user123:password@proxy.weproxies.com:1080" \
--connect-timeout 10 \
--max-time 30 \
https://api.ipify.org?format=json
Follow Redirects
curl -L -x "http://wp_user123:password@proxy.weproxies.com:1080" \
https://example.com
Save Output to File
curl -x "http://wp_user123:password@proxy.weproxies.com:1080" \
-o response.html \
https://example.com
POST Request
curl -x "http://wp_user123:password@proxy.weproxies.com:1080" \
-X POST \
-H "Content-Type: application/json" \
-d '{"key": "value"}' \
https://api.example.com/endpoint
Environment Variables
Set proxy globally for all cURL requests:
# Set environment variables
export http_proxy="http://wp_user123:password@proxy.weproxies.com:1080"
export https_proxy="http://wp_user123:password@proxy.weproxies.com:1080"
export HTTP_PROXY="http://wp_user123:password@proxy.weproxies.com:1080"
export HTTPS_PROXY="http://wp_user123:password@proxy.weproxies.com:1080"
# Now all curl requests use the proxy automatically
curl https://api.ipify.org?format=json
Disable Proxy for Specific Request
curl --noproxy "*" https://api.ipify.org?format=json
Shell Scripts
Loop Through Countries
#!/bin/bash
USERNAME="wp_user123"
PASSWORD="password"
COUNTRIES=("US" "GB" "DE" "FR" "JP")
for country in "${COUNTRIES[@]}"; do
echo "Fetching from $country..."
curl -s -x "http://${USERNAME}-country-${country}:${PASSWORD}@proxy.weproxies.com:1080" \
https://api.ipify.org?format=json
echo ""
done
Verify Geolocation
#!/bin/bash
USERNAME="wp_user123"
PASSWORD="password"
COUNTRY="US"
echo "Testing proxy for country: $COUNTRY"
echo "---"
response=$(curl -s -x "http://${USERNAME}-country-${COUNTRY}:${PASSWORD}@proxy.weproxies.com:1080" \
https://ipapi.co/json/)
echo "$response" | python3 -c "
import sys, json
data = json.load(sys.stdin)
print(f\"IP: {data.get('ip')}\")
print(f\"Country: {data.get('country_name')} ({data.get('country_code')})\")
print(f\"Region: {data.get('region')}\")
print(f\"City: {data.get('city')}\")
"
Retry on Failure
#!/bin/bash
max_retries=3
retry_count=0
url="https://example.com"
proxy="http://wp_user123:password@proxy.weproxies.com:1080"
while [ $retry_count -lt $max_retries ]; do
response=$(curl -s -w "%{http_code}" -o /dev/null -x "$proxy" "$url")
if [ "$response" = "200" ]; then
echo "Success!"
curl -x "$proxy" "$url"
exit 0
fi
retry_count=$((retry_count + 1))
echo "Attempt $retry_count failed with status $response. Retrying..."
sleep 2
done
echo "Failed after $max_retries attempts"
exit 1
Handling Special Characters
If your password contains special characters, URL-encode them:
# Password: my@pass:word
# Encoded: my%40pass%3Aword
curl -x "http://wp_user123:my%40pass%3Aword@proxy.weproxies.com:1080" \
https://api.ipify.org
Common Character Encodings
| Character | URL Encoded |
|---|---|
@ | %40 |
: | %3A |
/ | %2F |
# | %23 |
? | %3F |
% | %25 |
& | %26 |
= | %3D |
Debugging Connection Issues
Test Connectivity
# Check if proxy is reachable
curl -v -x "http://wp_user123:password@proxy.weproxies.com:1080" \
https://api.ipify.org
Check Response Headers
curl -I -x "http://wp_user123:password@proxy.weproxies.com:1080" \
https://example.com
Show Timing Information
curl -x "http://wp_user123:password@proxy.weproxies.com:1080" \
-w "Time: %{time_total}s\n" \
-o /dev/null -s \
https://api.ipify.org
Common Errors
407 Proxy Authentication Required
curl: (407) Proxy Authentication Required
Solution: Check username and password are correct.
Connection Refused
curl: (7) Failed to connect to proxy.weproxies.com port 1080
Solution: Check network/firewall allows outbound connections to port 1080.
Timeout
curl: (28) Operation timed out
Solution: Increase timeout or check your internet connection.