Overview

Practical code examples for using Residential Proxy with different programming languages and frameworks.

Ready-to-use code examples for integrating Residential Proxy into your applications. Choose your programming language to get started.

Quick Reference

Example Proxy Configurations

# No country specified, falls back to US, rotating IP
user:password@proxy.mrscraper.com:10000

These examples default to HTTP

The snippets on this page and in most language guides use the HTTP endpoint on port 10000 because it needs no extra dependencies. SOCKS5 is fully supported on port 10001 with the socks5:// prefix, and every username parameter works the same on both. Each language page has a SOCKS5 Proxy Setup section with the client-specific setup, and Proxy Types compares the two protocols.

Examples by Language & Framework

Best Practices

1. Error Handling

Always implement proper error handling and retry logic:

  • Catch connection timeouts
  • Handle proxy authentication failures
  • Retry failed requests with exponential backoff

2. Session Management

  • Use unique session IDs for parallel operations
  • Set appropriate session durations (10-60 minutes)
  • Reuse sessions for related requests

3. Rate Limiting

  • Respect target website's rate limits
  • Use rotating proxies for high-volume scraping
  • Add delays between requests when appropriate

4. Security

  • Never hardcode credentials in source code
  • Use environment variables for sensitive data
  • Rotate credentials regularly

Common Use Cases

Web Scraping

Use rotating proxies with country targeting to scrape large amounts of data while avoiding rate limits and IP bans.

Account Management

Use static proxies with custom session duration to maintain consistent IPs for login flows and account operations.

Market Research

Use static or rotating proxies with country targeting to view localized content and pricing across different regions.

Testing & QA

Use static proxies with various country codes to test your application's behavior across different IP addresses and geographic locations.

On this page