Code Sample
Explore Rapidproxy code samples for using residential proxies with cURL, Python, Node.js, Puppeteer, and Java. Learn how to configure proxy authentication and integrate proxies into your applications.
This page provides ready-to-use code examples for integrating Rapidproxy proxies in various programming languages and tools. Explore integration examples for Dynamic (Rotating) Residential Proxies, Static Residential Proxies, and Unlimited Residential Proxies using industry-standard authentication methods.
1. General Usage & How to Read These Examples
Rapidproxy supports multiple proxy authentication methods including:
Username & Password Auth — credentials for each sub-account
IP Whitelisting — allowlisted source IP authentication
You’ll see examples using both methods where applicable.
Note: Replace placeholder values like
YOUR_PROXY_HOST,YOUR_PORT,YOUR_USERNAME,YOUR_PASSWORDwith real values from your Rapidproxy dashboard.
2. cURL Examples
Dynamic Residential Proxy — Username & Password
curl -x http://YOUR_USERNAME:YOUR_PASSWORD@YOUR_PROXY_HOST:YOUR_PORT https://example.comDynamic Residential Proxy — IP Whitelist (no credentials)
curl -x http://YOUR_PROXY_HOST:YOUR_PORT https://example.com(Ensure your current IP is whitelisted before using this request.)
Static Residential Proxy
Unlimited Residential Proxies
3. Python Example (requests library)
With Username & Password Auth
With IP Whitelisting Only
Unlimited Residential Proxies
4. Node.js Example (axios)
With Username & Password Auth
With IP Whitelisting Only
Unlimited Residential Proxies
5. Puppeteer Example (Headless Browser)
With Username & Password Auth
6. Java Example (Apache HttpClient)
With Username & Password Auth
Unlimited Residential Proxies
7. Unlimited Residential Proxies - Additional Code Examples
PHP
GO
C#
8. Tips for Using Proxies in Code
Protocol Support
HTTP and HTTPS are both supported
SOCKS5 can be used if your client supports the protocol
Sticky Sessions (Dynamic Proxies)
If you configured a sticky session when generating proxy credentials:
Each request within the session will use the same IP
Useful for login, form submission, and session-based automation
IP Whitelist
If using IP whitelisting:
Confirm the source IP of your application or server is added to the whitelist
Requests from non-whitelisted IPs will be blocked
9. Troubleshooting
If your code receives proxy errors:
Double-check proxy host/port values
Ensure credentials are correct (for username/password authentication)
Verify your IP is whitelisted (if applicable)
Check that your tool/client supports the proxy protocol you are using
If issues persist, contact support:
Online live chat on the Rapidproxy website
Email:
support@rapidproxy.io
10. Security Notes
Never share credentials publicly
Store proxy usernames & passwords in secure configuration or environment variables
Rotate credentials if compromised
Last updated
