Proxy Access

Credentials

Basic cURL Example

 

Select City

To narrow down to a city-level targeting, a city parameter needs to be added. For example, region-us-city-los_angeles means that a proxy from Los_Angeles, United States, will handle the query. We support every city in the world, but we do not guarantee we will have proxies there. Most popular cities are well covered, and will have many proxies to choose from.
In this example a query to ipinfo.io is performed from a random IP address from Los_Angeles, United States:

curl -x 43.135.125.66:30000 -U "user-Uername-region-us-city-los_angeles-sessid-us1-sesstime-1:password" myip.roxlabs.io

 

Here are a few examples of valid combinations of region and city parameters:
region-US-city-los_angeles
region-US-city-boston
region-US-city-houston
region-TH-city-bangkok
region-DE-city-munich

Formatted:Proxy:List

Programmatic Access

Automation Examples

Golang Example

proxy := "https://:@:20000"
url := "myip.roxlabs.io"
os.Setenv("HTTP_PROXY", proxy)
resp, err := http.Get(url)
...

Node.js Example (got package)

const got = require('got');
const {
  HttpsProxyAgent
} = require('hpagent');
got('myip.roxlabs.io', {
  agent: {
    https: new HttpsProxyAgent({
      proxy: 'https://:@:20000'
    })
  }
}).then(respone => {
  console.log(respone.body);
}).catch(err => {
  console.log(err.response.body);
});

Node.js Example (request package, deprecated)

const request = require('request');
const proxy = "https://:@:20000"
const url = "myip.roxlabs.io";
const proxiedRequest = request.defaults({
  'proxy': proxy
});

proxiedRequest.get(url, function(err, resp, body) {
  ...
});

Python Example

import requests

http_proxy = ":@:20000"
https_proxy = ":@:20000"
url = "myip.roxlabs.io"

proxyDict = {
    "http": http_proxy,
    "https": https_proxy,
}

r = requests.get(url, proxies=proxyDict)
...

PHP Example

$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "myip.roxlabs.io",
CURLOPT_PROXY => "https://:@:20000"
CURLOPT_FOLLOWLOCATION => 1,
CURLOPT_RETURNTRANSFER => 1,
));
$response = curl_exec($curl);
...

C# Example

using System;
using System.IO;
using System.Net;
namespace packetstreamExample {
  class ProxyConnect {
    static void Main(string[] args) {
      string proxyUser = "";

      string proxyPass = "";

      WebProxy proxyObject = new WebProxy(":20000", true);
      proxyObject.Credentials = new NetworkCredential(proxyUser, proxyPass);
      WebRequest request = WebRequest.Create("myip.roxlabs.io");
      request.Proxy = proxyObject;
      HttpWebResponse response = (HttpWebResponse) request.GetResponse();
      Console.WriteLine(response.StatusDescription);
      Stream dataStream = response.GetResponseStream();
      StreamReader reader = new StreamReader(dataStream);
      string responseFromServer = reader.ReadToEnd();
      Console.WriteLine(responseFromServer);
      reader.Close();
      dataStream.Close();
      response.Close();
      ...
    }
  }
}

Java Example

import java.net. * ;
import java.io. * ;
public class ProxyConnect {
  public static void main(String[] args) throws MalformedURLException,
  ProtocolException,
  IOException {
    final String authUser = "";

    final String authPassword = "";

    final String proxyHost = "";
    final int proxyPort = 20000;
    final String destURL = "myip.roxlabs.io";

    System.setProperty("jdk.http.auth.tunneling.disabledSchemes", "");
    System.setProperty("jdk.http.auth.proxying.disabledSchemes", "");

    Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));

    URL url = new URL(destURL);
    HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy);

    Authenticator.setDefault(new Authenticator() {@Override
      protected PasswordAuthentication getPasswordAuthentication() {
        if (getRequestorType().equals(RequestorType.PROXY)) {
          return new PasswordAuthentication(authUser, authPassword.toCharArray());
        }
        return super.getPasswordAuthentication();
      }
    });

    StringBuilder content;

    try (BufferedReader in =new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
      String line;
      content = new StringBuilder();

      while ((line = in.readLine()) != null) {
        content.append(line);
        content.append(System.lineSeparator());
      }

      System.out.println(content.toString());

    } catch(Throwable e) {
      System.err.println(e);
    } finally {
      connection.disconnect();
    }
  }
}