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@proxy.mrscraper.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 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.