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
# Random country, rotating IP
user:password@network.mrproxy.com:10000Examples by Language
Python
Examples with requests, BeautifulSoup, and asyncio
Node.js
Examples with axios, Puppeteer, and native http
cURL
Command-line examples for quick testing
PHP
Examples with cURL and Guzzle
Ruby
Examples with Net::HTTP and HTTParty
Go
Examples with net/http package
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 to scrape large amounts of data while avoiding rate limits and IP bans.
Best Choice: Rotating proxies with country targeting
Account Management
Use static session-based proxies to maintain consistent IPs for login flows and account operations.
Best Choice: Static proxies with custom session duration
Market Research
Use country-specific proxies to view localized content and pricing across different regions.
Best Choice: Static or rotating proxies with country targeting
Testing & QA
Test your application's behavior with different IP addresses and geographic locations.
Best Choice: Static proxies with various country codes