management
hold

315271140@qq.com

Proxy Access

Credentials

Basic cURL Example

 

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();
    }
  }
}