### Basic usage with HTTP and SOCKS5 proxies Source: https://docs.trueproxies.com/integrations/go Basic usage examples for HTTP and SOCKS5 proxies. The HTTP example uses net/http with a proxy URL, while the SOCKS5 example uses golang.org/x/net/proxy. Both make a GET request to https://httpbin.org/ip and print the response body. ```go package main import ( "fmt" "io" "net/http" "net/url" ) func main() { proxyURL, _ := url.Parse("http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT") client := &http.Client{ Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}, } resp, err := client.Get("https://httpbin.org/ip") if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) } ``` ```go package main import ( "fmt" "io" "net/http" "golang.org/x/net/proxy" ) func main() { auth := proxy.Auth{User: "your_username", Password: "your_password"} dialer, _ := proxy.SOCKS5("tcp", "YOUR_HOST:YOUR_SOCKS_PORT", &auth, proxy.Direct) client := &http.Client{ Transport: &http.Transport{Dial: dialer.Dial}, } resp, err := client.Get("https://httpbin.org/ip") if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) } ``` -------------------------------- ### Install Python client libraries Source: https://docs.trueproxies.com/integrations/python Install the Python client libraries needed for HTTP and SOCKS5 proxy usage with TrueProxies. ```bash pip install requests "requests[socks]" aiohttp aiohttp-socks ``` -------------------------------- ### Run the example spider Source: https://docs.trueproxies.com/integrations/scrapy Run the example spider with the command 'scrapy crawl ip_check'. ```bash scrapy crawl ip_check ``` -------------------------------- ### Advanced targeting example for GB-based product Source: https://docs.trueproxies.com/proxy-instructions/how-to-connect Shows how to combine country, city, and session options in the username for GB-based Residential IPv4. Use with curl, replacing YOUR_HOST, YOUR_HTTP_PORT, YOUR_USERNAME, and YOUR_PASSWORD. ```bash curl -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "YOUR_USERNAME-country-de-city-berlin-session-ab12cd:YOUR_PASSWORD" \ https://httpbin.org/ip ``` -------------------------------- ### Sticky session with lifetime example Source: https://docs.trueproxies.com/proxy-instructions/how-to-connect Requests the same exit IP for up to ten minutes by using a session value and a lifetime of 600 seconds. Replace placeholders with real values. ```bash # Same IP for up to ten minutes curl -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "YOUR_USERNAME-session-ab12cd-lifetime-600:YOUR_PASSWORD" \ https://httpbin.org/ip ``` -------------------------------- ### Configure HttpClient (Java 11+) with proxy Source: https://docs.trueproxies.com/integrations/java Configures a Java 11+ HttpClient to use a proxy at YOUR_HOST:8080 with username/password authentication. The example sends a GET request to https://httpbin.org/ip and prints the response body. Replace YOUR_HOST, your_username, and your_password with your actual proxy credentials. ```java import java.net.*; import java.net.http.*; public class ProxyExample { public static void main(String[] args) throws Exception { var proxy = ProxySelector.of( new InetSocketAddress("YOUR_HOST", 8080) ); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( "your_username", "your_password".toCharArray() ); } }); var client = HttpClient.newBuilder() .proxy(proxy) .authenticator(Authenticator.getDefault()) .build(); var request = HttpRequest.newBuilder() .uri(URI.create("https://httpbin.org/ip")) .build(); var response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` -------------------------------- ### SOCKS5 proxy with requests Source: https://docs.trueproxies.com/integrations/python Use the requests library with a SOCKS5 proxy. Replace YOUR_HOST and YOUR_SOCKS_PORT with your proxy details. The example sets a 30-second timeout and prints the JSON response. ```python import requests username = "your_username" password = "your_password" proxy_url = f"socks5h://{username}:{password}@YOUR_HOST:YOUR_SOCKS_PORT" response = requests.get( "https://httpbin.org/ip", proxies={ "http": proxy_url, "https": proxy_url, }, timeout=30, ) print(response.json()) ``` -------------------------------- ### HTTP proxy with HttpClient Source: https://docs.trueproxies.com/integrations/csharp Configures an HTTP proxy with credentials and uses it with HttpClient to make a GET request to https://httpbin.org/ip. Replace YOUR_HOST, YOUR_HTTP_PORT, your_username, and your_password with your actual proxy details. ```csharp using System.Net; var proxy = new WebProxy("http://YOUR_HOST:YOUR_HTTP_PORT") { Credentials = new NetworkCredential("your_username", "your_password") }; var handler = new HttpClientHandler { Proxy = proxy }; var client = new HttpClient(handler); var response = await client.GetStringAsync("https://httpbin.org/ip"); Console.WriteLine(response); ``` -------------------------------- ### Configure HttpURLConnection with proxy Source: https://docs.trueproxies.com/integrations/java Uses HttpURLConnection with a proxy at YOUR_HOST:8080 and authenticates with username/password. The example opens a connection to https://httpbin.org/ip and prints the response line by line. Replace YOUR_HOST, your_username, and your_password with your actual proxy credentials. ```java import java.io.*; import java.net.*; public class ProxyExample { public static void main(String[] args) throws Exception { Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("YOUR_HOST", 8080)); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( "your_username", "your_password".toCharArray() ); } }); URL url = new URL("https://httpbin.org/ip"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(proxy); BufferedReader reader = new BufferedReader( new InputStreamReader(conn.getInputStream()) ); String line; while ((line = reader.readLine()) != null) { System.out.println(line); } reader.close(); } } ``` -------------------------------- ### HTTP proxy with requests Source: https://docs.trueproxies.com/integrations/python Use the requests library with an HTTP proxy. Replace YOUR_HOST and YOUR_HTTP_PORT with your proxy details. The example sets a 30-second timeout and prints the status code and response text. ```python import requests username = "your_username" password = "your_password" proxy_url = f"http://{username}:{password}@YOUR_HOST:YOUR_HTTP_PORT" response = requests.get( "https://httpbin.org/ip", proxies={ "http": proxy_url, "https": proxy_url, }, timeout=30, ) print(response.status_code) print(response.text) ``` -------------------------------- ### Basic usage with HTTP and SOCKS5 proxies Source: https://docs.trueproxies.com/integrations/puppeteer Basic Puppeteer setup for HTTP and SOCKS5 proxies. Launch the browser with the proxy server argument, authenticate with your TrueProxies credentials, then navigate to httpbin.org/ip to verify the IP. Replace YOUR_HOST, YOUR_HTTP_PORT, YOUR_SOCKS_PORT, your_username, and your_password with your actual values. ```javascript import puppeteer from 'puppeteer'; const browser = await puppeteer.launch({ args: ['--proxy-server=http://YOUR_HOST:YOUR_HTTP_PORT'], }); const page = await browser.newPage(); await page.authenticate({ username: 'your_username', password: 'your_password', }); await page.goto('https://httpbin.org/ip'); const content = await page.content(); console.log(content); await browser.close(); ``` ```javascript import puppeteer from 'puppeteer'; const browser = await puppeteer.launch({ args: ['--proxy-server=socks5://YOUR_HOST:YOUR_SOCKS_PORT'], }); const page = await browser.newPage(); await page.authenticate({ username: 'your_username', password: 'your_password', }); await page.goto('https://httpbin.org/ip'); const content = await page.content(); console.log(content); await browser.close(); ``` -------------------------------- ### Configure cURL with HTTP and SOCKS5 proxies Source: https://docs.trueproxies.com/integrations/php Use these cURL examples to route requests through TrueProxies via HTTP or SOCKS5. Replace YOUR_HOST, YOUR_HTTP_PORT/YOUR_SOCKS_PORT, and your_username:your_password with your actual proxy credentials. The response from https://httpbin.org/ip is printed to the output. ```php None: async with ClientSession(connector=connector) as session: async with session.get("https://httpbin.org/ip", timeout=30) as response: print(response.status) print(await response.text()) asyncio.run(main()) ``` -------------------------------- ### SOCKS5 proxy with HttpClient Source: https://docs.trueproxies.com/integrations/csharp Configures a SOCKS5 proxy with credentials and uses it with HttpClient to make a GET request to https://httpbin.org/ip. Replace YOUR_HOST, YOUR_SOCKS_PORT, your_username, and your_password with your actual proxy details. ```csharp using System.Net; var proxy = new WebProxy("socks5://YOUR_HOST:YOUR_SOCKS_PORT") { Credentials = new NetworkCredential("your_username", "your_password") }; var handler = new HttpClientHandler { Proxy = proxy }; var client = new HttpClient(handler); var response = await client.GetStringAsync("https://httpbin.org/ip"); Console.WriteLine(response); ``` -------------------------------- ### Per-context proxies with Playwright Source: https://docs.trueproxies.com/integrations/playwright Use different proxies per browser context by passing the proxy configuration to browser.newContext(). This example uses a German residential proxy and then closes the context and browser. ```javascript const browser = await chromium.launch(); const context = await browser.newContext({ proxy: { server: 'http://YOUR_HOST:YOUR_HTTP_PORT', username: 'your_username-country-de', password: 'your_password', }, }); const page = await context.newPage(); await page.goto('https://httpbin.org/ip'); console.log(await page.textContent('body')); await context.close(); await browser.close(); ``` -------------------------------- ### Example spider to check IP Source: https://docs.trueproxies.com/integrations/scrapy Example Scrapy spider that checks the IP address by requesting https://httpbin.org/ip and logging the origin IP from the JSON response. ```python import scrapy class IpSpider(scrapy.Spider): name = "ip_check" start_urls = ["https://httpbin.org/ip"] def parse(self, response): self.logger.info(f"IP: {response.json()['origin']}") ``` -------------------------------- ### Launch Playwright with HTTP proxy (Chromium and Firefox) Source: https://docs.trueproxies.com/integrations/playwright Launch a Playwright browser with a TrueProxies HTTP proxy. The example shows both Chromium and Firefox variants, using the same proxy configuration and then navigating to https://httpbin.org/ip to verify the IP. ```javascript import { chromium } from 'playwright'; const browser = await chromium.launch({ proxy: { server: 'http://YOUR_HOST:YOUR_HTTP_PORT', username: 'your_username', password: 'your_password', }, }); const page = await browser.newPage(); await page.goto('https://httpbin.org/ip'); console.log(await page.textContent('body')); await browser.close(); ``` ```javascript import { firefox } from 'playwright'; const browser = await firefox.launch({ proxy: { server: 'http://YOUR_HOST:YOUR_HTTP_PORT', username: 'your_username', password: 'your_password', }, }); const page = await browser.newPage(); await page.goto('https://httpbin.org/ip'); console.log(await page.textContent('body')); await browser.close(); ``` -------------------------------- ### Make a Residential IPv4 request with curl Source: https://docs.trueproxies.com/getting-started/quickstart Use this curl command to make your first Residential IPv4 request. Replace YOUR_HOST, YOUR_HTTP_PORT, your_username, and your_password with the exact values from the dashboard. The returned IP should differ from your direct public IP and match the address family and placement assigned to the product. ```bash curl -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "your_username:your_password" \ https://httpbin.org/ip ``` -------------------------------- ### Connect with curl over HTTP, HTTPS, and SOCKS5 Source: https://docs.trueproxies.com/proxy-instructions/how-to-connect Use these curl commands to connect to the proxy over HTTP, HTTPS, or SOCKS5. Replace YOUR_HOST, YOUR_HTTP_PORT, YOUR_HTTPS_PORT, YOUR_SOCKS_PORT, YOUR_USERNAME, and YOUR_PASSWORD with the values from the dashboard. For SOCKS5, use --socks5-hostname (or the socks5h:// scheme) so hostnames are resolved at the exit. ```bash curl -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "YOUR_USERNAME:YOUR_PASSWORD" \ https://httpbin.org/ip ``` ```bash curl -x https://YOUR_HOST:YOUR_HTTPS_PORT \ --proxy-user "YOUR_USERNAME:YOUR_PASSWORD" \ https://httpbin.org/ip ``` ```bash curl --socks5-hostname YOUR_HOST:YOUR_SOCKS_PORT \ --proxy-user "YOUR_USERNAME:YOUR_PASSWORD" \ https://httpbin.org/ip ``` -------------------------------- ### Residential IPv4 sticky sessions Source: https://docs.trueproxies.com/integrations/csharp Sets up a WebProxy with credentials that include a session identifier (e.g., '-session-abc123') to maintain a sticky session for residential IPv4 proxies. Replace YOUR_HOST, YOUR_HTTP_PORT, your_username, and your_password with your actual details. ```csharp var proxy = new WebProxy("http://YOUR_HOST:YOUR_HTTP_PORT") { Credentials = new NetworkCredential("your_username-session-abc123", "your_password") }; ``` -------------------------------- ### Basic SOCKS5 proxy usage with cURL Source: https://docs.trueproxies.com/integrations/curl Use the --socks5 flag with the SOCKS5 proxy host and port. Replace YOUR_HOST, YOUR_SOCKS_PORT, your_username, and your_password with your TrueProxies credentials. ```bash curl --socks5 YOUR_HOST:YOUR_SOCKS_PORT \ -U "your_username:your_password" \ https://httpbin.org/ip ``` -------------------------------- ### Configure Guzzle HTTP client with proxy Source: https://docs.trueproxies.com/integrations/php Configure a Guzzle client to use a TrueProxies HTTP proxy by setting the 'proxy' option with the full URL including credentials. Requires the Guzzle library via Composer (vendor/autoload.php). The response body from https://httpbin.org/ip is echoed. ```php 'http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT', ]); $response = $client->get('https://httpbin.org/ip'); echo $response->getBody(); ``` -------------------------------- ### Add country targeting to TrueProxiesMiddleware Source: https://docs.trueproxies.com/integrations/scrapy Extend the TrueProxiesMiddleware to target a specific country for Residential IPv4. It reads the 'country' meta (defaulting to 'us') and appends '-country-{country}' to the username. ```python class TrueProxiesMiddleware: def process_request(self, request, spider): country = request.meta.get("country", "us") username = f"{spider.settings['PROXY_USER']}-country-{country}" request.meta["proxy"] = ( f"http://{username}:{spider.settings['PROXY_PASS']}" f"@{spider.settings['PROXY_HOST']}:{spider.settings['PROXY_PORT']}" ) ``` -------------------------------- ### Find your public IP address with curl Source: https://docs.trueproxies.com/proxy-instructions/trusted-ips Run this command on the machine that will open the proxy connections to find the address you will connect from. ```bash curl https://httpbin.org/ip ``` -------------------------------- ### Multiple pages with different IPs Source: https://docs.trueproxies.com/integrations/puppeteer Open multiple pages with different IPs by creating a new page for each URL in a loop. Each page authenticates with the same credentials, and the proxy assigns a different IP per page. Replace the URLs and credentials as needed. ```javascript const browser = await puppeteer.launch({ args: ['--proxy-server=http://YOUR_HOST:YOUR_HTTP_PORT'], }); const urls = ['https://example.com', 'https://example.org']; for (const url of urls) { const page = await browser.newPage(); await page.authenticate({ username: 'your_username', password: 'your_password', }); await page.goto(url); console.log(`${url}: loaded`); await page.close(); } await browser.close(); ``` -------------------------------- ### HTTP client with proxy and timeout Source: https://docs.trueproxies.com/integrations/go Adds a 30-second timeout to an HTTP client that uses a proxy. Requires the proxyURL variable to be defined beforehand. ```go client := &http.Client{ Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}, Timeout: 30 * time.Second, } ``` -------------------------------- ### Enable TrueProxiesMiddleware in settings.py Source: https://docs.trueproxies.com/integrations/scrapy Enable the custom TrueProxiesMiddleware in Scrapy's settings.py by adding it to DOWNLOADER_MIDDLEWARES with priority 100. ```python DOWNLOADER_MIDDLEWARES = { "myproject.middlewares.TrueProxiesMiddleware": 100, } ``` -------------------------------- ### Residential IPv4 sticky sessions with username parameter Source: https://docs.trueproxies.com/integrations/go Configures a proxy URL with a sticky session parameter in the username (e.g., -session-abc123) for residential IPv4. Use this to maintain the same IP address across requests. ```go proxyURL, _ := url.Parse("http://your_username-session-abc123:your_password@YOUR_HOST:YOUR_HTTP_PORT") client := &http.Client{ Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}, } ``` -------------------------------- ### Configure Selenium Firefox with proxy Source: https://docs.trueproxies.com/integrations/selenium Configure Selenium with Firefox to use a proxy. Set PROXY_HOST and PROXY_PORT, then the driver sends requests through the proxy and prints the response from httpbin.org/ip. ```python from selenium import webdriver from selenium.webdriver.firefox.options import Options PROXY_HOST = "YOUR_HOST" PROXY_PORT = 8080 options = Options() options.set_preference("network.proxy.type", 1) options.set_preference("network.proxy.http", PROXY_HOST) options.set_preference("network.proxy.http_port", PROXY_PORT) options.set_preference("network.proxy.ssl", PROXY_HOST) options.set_preference("network.proxy.ssl_port", PROXY_PORT) driver = webdriver.Firefox(options=options) driver.get("https://httpbin.org/ip") print(driver.page_source) driver.quit() ``` -------------------------------- ### Residential IPv4 country targeting with username suffix Source: https://docs.trueproxies.com/integrations/java Shows how to target a specific country (US) for Residential IPv4 proxies by appending -country-us to the username in the PasswordAuthentication constructor. Replace your_username and your_password with your actual credentials. ```java return new PasswordAuthentication( "your_username-country-us", "your_password".toCharArray() ); ``` -------------------------------- ### Connect without credentials using curl Source: https://docs.trueproxies.com/proxy-instructions/trusted-ips Send no credentials at all to connect without targeting. Uses the service's usual connection host and ports. ```bash curl -x http://YOUR_HOST:YOUR_HTTP_PORT \ https://httpbin.org/ip ``` -------------------------------- ### Use TrueProxies with Playwright Python Source: https://docs.trueproxies.com/integrations/playwright Use TrueProxies with Playwright's Python sync API. Launches Chromium with an HTTP proxy and prints the response body from https://httpbin.org/ip. ```python from playwright.sync_api import sync_playwright with sync_playwright() as p: browser = p.chromium.launch(proxy={ "server": "http://YOUR_HOST:YOUR_HTTP_PORT", "username": "your_username", "password": "your_password", }) page = browser.new_page() page.goto("https://httpbin.org/ip") print(page.text_content("body")) browser.close() ``` -------------------------------- ### Targeting without a password using SOCKS5 Source: https://docs.trueproxies.com/proxy-instructions/trusted-ips Works for SOCKS5 clients that offer a username but no password. Send your username with options and leave the password empty. ```bash curl --socks5-hostname YOUR_HOST:YOUR_SOCKS_PORT \ --proxy-user "YOUR_USERNAME-country-de:" \ https://httpbin.org/ip ``` -------------------------------- ### Use SOCKS5 proxy with Playwright Source: https://docs.trueproxies.com/integrations/playwright Configure Playwright to use a SOCKS5 proxy with TrueProxies. Replace YOUR_HOST and YOUR_SOCKS_PORT with your SOCKS5 endpoint. ```javascript const browser = await chromium.launch({ proxy: { server: 'socks5://YOUR_HOST:YOUR_SOCKS_PORT', username: 'your_username', password: 'your_password', }, }); ``` -------------------------------- ### Set proxy username for country targeting Source: https://docs.trueproxies.com/integrations/selenium Set the username parameter to target a specific residential IPv4 country. Replace 'us' with the desired country code. ```python PROXY_USER = "your_username-country-us" ``` -------------------------------- ### Targeting without a password using curl Source: https://docs.trueproxies.com/proxy-instructions/trusted-ips Send your username with options and leave the password empty to keep targeting from a trusted IP. The username must be the service's own username followed by the options. ```bash curl -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "YOUR_USERNAME-session-ab12cd-country-de:" \ https://httpbin.org/ip ``` -------------------------------- ### Configure proxy middleware in settings.py Source: https://docs.trueproxies.com/integrations/scrapy Add the proxy middleware and define proxy credentials in Scrapy's settings.py. The HttpProxyMiddleware is set to 110, and the proxy host, port, username, and password are configured as settings variables. ```python DOWNLOADER_MIDDLEWARES = { "scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware": 110, } PROXY_USER = "your_username" PROXY_PASS = "your_password" PROXY_HOST = "YOUR_HOST" PROXY_PORT = 8080 ``` -------------------------------- ### Residential IPv4 country targeting Source: https://docs.trueproxies.com/integrations/csharp Sets up a WebProxy with credentials that include a country code (e.g., '-country-us') to target a specific country for residential IPv4 proxies. Replace YOUR_HOST, YOUR_HTTP_PORT, your_username, and your_password with your actual details. ```csharp var proxy = new WebProxy("http://YOUR_HOST:YOUR_HTTP_PORT") { Credentials = new NetworkCredential("your_username-country-us", "your_password") }; ``` -------------------------------- ### axios proxy config Source: https://docs.trueproxies.com/integrations/javascript Use axios's built-in proxy option to route requests through a TrueProxies HTTP proxy. Replace YOUR_HOST, your_username, and your_password with your credentials. ```javascript import axios from 'axios'; const response = await axios.get('https://httpbin.org/ip', { proxy: { host: 'YOUR_HOST', port: 8080, auth: { username: 'your_username', password: 'your_password' }, }, }); console.log(response.data); ``` -------------------------------- ### Residential IPv4 country targeting with username parameter Source: https://docs.trueproxies.com/integrations/go Configures a proxy URL with a country targeting parameter in the username (e.g., -country-us) for residential IPv4. Use this to route requests through a specific country. ```go proxyURL, _ := url.Parse("http://your_username-country-us:your_password@YOUR_HOST:YOUR_HTTP_PORT") client := &http.Client{ Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}, } ``` -------------------------------- ### node-fetch with HttpsProxyAgent Source: https://docs.trueproxies.com/integrations/javascript Use node-fetch with HttpsProxyAgent to make proxied requests. Pass the agent to fetch and parse the JSON response. ```javascript import fetch from 'node-fetch'; import { HttpsProxyAgent } from 'https-proxy-agent'; const agent = new HttpsProxyAgent( 'http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT' ); const response = await fetch('https://httpbin.org/ip', { agent }); const data = await response.json(); console.log(data); ``` -------------------------------- ### Common cURL options for TrueProxies Source: https://docs.trueproxies.com/integrations/curl Common cURL options: -L follows redirects, --max-time sets a timeout, -o saves response to file, and -v gives verbose output for debugging. Each option is used with the proxy flags. ```bash # Follow redirects curl -L -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "your_username:your_password" \ https://example.com # Set timeout (30 seconds) curl --max-time 30 -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "your_username:your_password" \ https://httpbin.org/ip # Save response to file curl -o response.json -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "your_username:your_password" \ https://httpbin.org/ip # Verbose output for debugging curl -v -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "your_username:your_password" \ https://httpbin.org/ip ``` -------------------------------- ### Residential IPv4 sticky sessions with cURL Source: https://docs.trueproxies.com/integrations/curl Keep the same IP across multiple requests by appending -session- to the username. Replace 'abc123' with your session identifier. ```bash curl -x http://YOUR_HOST:YOUR_HTTP_PORT \ -U "your_username-session-abc123:your_password" \ https://httpbin.org/ip ``` -------------------------------- ### Residential IPv4 sticky sessions with cURL Source: https://docs.trueproxies.com/integrations/php Set the CURLOPT_PROXYUSERPWD option to use a sticky session by appending '-session-abc123' to the username. Replace your_username, your_password, and the session identifier with your actual values. ```php curl_setopt($ch, CURLOPT_PROXYUSERPWD, "your_username-session-abc123:your_password"); ``` -------------------------------- ### Native fetch with undici ProxyAgent Source: https://docs.trueproxies.com/integrations/javascript Use Node.js 18+ native fetch with undici's ProxyAgent to route requests through a TrueProxies proxy. Set the dispatcher option to the proxy agent. ```javascript import { ProxyAgent } from 'undici'; const proxyAgent = new ProxyAgent( 'http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT' ); const response = await fetch('https://httpbin.org/ip', { dispatcher: proxyAgent, }); const data = await response.json(); console.log(data); ``` -------------------------------- ### Residential IPv4 country targeting with cURL Source: https://docs.trueproxies.com/integrations/php Set the CURLOPT_PROXYUSERPWD option to target a specific country (e.g., 'us') by appending '-country-us' to the username. Replace your_username and your_password with your actual credentials. ```php curl_setopt($ch, CURLOPT_PROXYUSERPWD, "your_username-country-us:your_password"); ``` -------------------------------- ### axios with HttpsProxyAgent Source: https://docs.trueproxies.com/integrations/javascript Use HttpsProxyAgent from https-proxy-agent with axios to route HTTPS requests through a TrueProxies proxy. The agent URL includes credentials and the proxy host and port. ```javascript import axios from 'axios'; import { HttpsProxyAgent } from 'https-proxy-agent'; const agent = new HttpsProxyAgent( 'http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT' ); const response = await axios.get('https://httpbin.org/ip', { httpsAgent: agent, }); console.log(response.data); ``` -------------------------------- ### Residential IPv4 sticky sessions Source: https://docs.trueproxies.com/integrations/javascript Append -session-abc123 to your username to maintain a sticky session. Replace abc123 with your session identifier. ```javascript const agent = new HttpsProxyAgent( 'http://your_username-session-abc123:your_password@YOUR_HOST:YOUR_HTTP_PORT' ); ``` -------------------------------- ### Configure Selenium Chrome with trusted IP proxy Source: https://docs.trueproxies.com/integrations/selenium Configure Selenium with Chrome to use a trusted IP proxy. Set PROXY to your host and HTTP port, then the driver sends requests through the proxy and prints the response from httpbin.org/ip. ```python from selenium import webdriver from selenium.webdriver.chrome.options import Options PROXY = "YOUR_HOST:YOUR_HTTP_PORT" chrome_options = Options() chrome_options.add_argument(f"--proxy-server=http://{PROXY}") driver = webdriver.Chrome(options=chrome_options) driver.get("https://httpbin.org/ip") print(driver.page_source) driver.quit() ``` -------------------------------- ### SOCKS5 with SocksProxyAgent Source: https://docs.trueproxies.com/integrations/javascript Use SocksProxyAgent from socks-proxy-agent with axios to route requests through a TrueProxies SOCKS5 proxy. The agent URL uses the socks5:// scheme. ```javascript import axios from 'axios'; import { SocksProxyAgent } from 'socks-proxy-agent'; const agent = new SocksProxyAgent( 'socks5://your_username:your_password@YOUR_HOST:YOUR_SOCKS_PORT' ); const response = await axios.get('https://httpbin.org/ip', { httpsAgent: agent, }); console.log(response.data); ``` -------------------------------- ### Set TrueProxies via environment variables Source: https://docs.trueproxies.com/integrations/curl Set http_proxy and https_proxy environment variables to use the proxy globally for all cURL requests. After exporting, all cURL commands will use the proxy automatically. ```bash export http_proxy="http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT" export https_proxy="http://your_username:your_password@YOUR_HOST:YOUR_HTTP_PORT" # Now all cURL requests use the proxy curl https://httpbin.org/ip ```