How to Use PrivateProxy.me Proxy

How to Use PrivateProxy.me Proxy

Do you know how to use PrivateProxy.me Proxy? This is the most comprehensive introduction from PrivateProxy.me official.

Usage Examples In Different Languages

Warning: these examples are meant to demonstrate that the proxies work. Do not use in production without extensive modifications.

curl in *nix shellPython 3 + requestsPHP + libcurlNode.js + stdlibRuby + stdlibGolang+stdlibC# + stdlib
curl -x http://pvtyproxies:[email protected]:5432 http://api.privateproxy.me:10738 #2.57.20.194
import requests
proxies = {
  'http': 'http://pvtyproxies:[email protected]:5432',
  'https': 'http://pvtyproxies:[email protected]:5432'
}
response = requests.get('http://api.privateproxy.me:10738', proxies=proxies)
// response.text = "2.57.20.194\\n"
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://api.privateproxy.me:10738");
curl_setopt($ch, CURLOPT_PROXY, "2.57.20.194:5432");
curl_setopt($ch, CURLOPT_PROXYUSERPWD, "pvtyproxies:ajd89akjdAdk");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$curl_scraped_page = curl_exec($ch);
curl_close($ch);

echo $curl_scraped_page; // "2.57.20.194\\n"
const http = require('http');
const https = require('https');

function getWithProxy(url, proxy) {
  const parsedUrl = new URL(url);
  const proxy_ip = proxy['ip']
  const proxy_port = proxy['port']
  const proxy_auth = 'Basic ' + Buffer.from(proxy['login'] + ':' + proxy['password']).toString('base64')

  let host = parsedUrl.hostname;
  if (parsedUrl.port !== '') {
    host += ':' + parsedUrl.port;
  } else {
    if (parsedUrl.protocol == 'http:') {
      host += ':80';
    } else if(parsedUrl.protocol == 'https:') {
      host += ':443';
    }
  }
  const res = new Promise((resolve, reject) => {
    http.request({
      port:   proxy_port,
      host:   proxy_ip,
      method: 'CONNECT',
      path:   host,
      headers: {
        'Host': host,
        'Proxy-Authorization': proxy_auth
      }
    }).on('connect', (res, socket, head) => {
      if (res.statusCode !== 200) {
        reject(new Error(`Non-200 status code returned from proxy: ${res.statusCode} ${res.statusMessage}`));
        return;
      }
      let t, real_opts = {};
      if (parsedUrl.protocol == "http:") {
        real_opts['createConnection'] = () => socket
        t = http;
      } else {
        real_opts['socket'] = socket;
        t = https;
      }
      const real_req = t.request(url, real_opts, (res) => {
        res.setEncoding('utf-8')
        let rawData = []
        res.on('data', (chunk) => rawData.push(chunk));
        res.on('end', () => resolve(rawData.join('')));
      });
      real_req.on('error', (e) => reject(e));
      real_req.end();
    }).end();
  });

  return res;
}

getWithProxy("https://httpbin.org/ip", {
  ip: '2.57.20.194',
  port: 5432,
  login: 'pvtyproxies',
  password: 'ajd89akjdAdk'
}).then(
    (data) => console.log(data.trim()),
    (e) => console.log("Error: " + e.toString())
).then(
  () => getWithProxy("http://api.privateproxy.me:10738", {
    ip: '2.57.20.194',
    port: 5432,
    login: 'pvtyproxies',
    password: 'ajd89akjdAdk'
  })
).then(
  (data) => console.log(data.trim()),
  (e) => console.log("Error: " + e.toString())
)
require 'net/http'

resp = Net::HTTP.start("api.privateproxy.me", 10738, "2.57.20.194", "5432", "pvtyproxies", "ajd89akjdAdk") do |h|
  request = Net::HTTP::Get.new('/')
  h.request(request)
end

puts resp.body # "2.57.20.194\\n"
package main

import (
  "fmt"
  "io/ioutil"
  "net/http"
  "net/url"
  "time"
)

func main() {
  proxy, err := url.Parse("http://pvtyproxies:[email protected]:5432")
  if err != nil {
    return
  }
  proxyFunc := http.ProxyURL(proxy)
  tr := &http.Transport{
    MaxIdleConns:       10,
    IdleConnTimeout:    30 * time.Second,
    DisableCompression: true,
    Proxy:              proxyFunc,
  }
  client := &http.Client{
    Transport: tr,
  }
  resp, err := client.Get("http://api.privateproxy.me:10738")
  if err != nil {
    return
  }
  defer resp.Body.Close()
  bytes, err := ioutil.ReadAll(resp.Body)
  if err != nil {
    return
  }
  fmt.Print(string(bytes)) // "2.57.20.194\\n"
}
var handler = new HttpClientHandler();
handler.Proxy = new WebProxy("http://pvtyproxies:[email protected]:5432/");

using (var httpClient = new HttpClient(handler))
{
  using (var request = new HttpRequestMessage(new HttpMethod("GET"), "http://api.privateproxy.me:10738"))
  {
    var response = await httpClient.SendAsync(request);
    // response.Content - "2.57.20.194\\n"
  }
}

http://api.privateproxy.me:10738 – shows your current IP address in text mode

There is no difference in using backconnect or normal proxies. Backconnect proxies act just like normal proxies, except target site sees different ips, depending on swap interval setting/manual swap.

You don't need to specify credentials if you've added your IP address to the authorized IPs list. Authorizing your IP isn't mandatory, you can continue using credentials authorization, whichever is more convenient.

If you're writing your own software to access some site, please add headers like User-Agent so that request looks like it came from a browser.


Browser Usage Recommendations

  • Turn off WebRTC, it can be used to spoil your real IP address even if you're using a proxy server, and even your local intranet IP address. Here's a link to a guide for disabling it for different browsers: https://www.vpnunlimitedapp.com/blog/how-to-disable-webrtc-in-chrome-and-other-browsers
  • Use tracker disabling addons like ghostery for chrome, sites can still identify you by your browser fingerprint.
  • If possible set your local computer time to the proxy server timezone.
  • If using backconnect, it's better to set swap interval to 5 or more minutes, so that you don't get IP changes too often.

Using Proxies With Python-Selenium

python-selenium + Firefox(geckodriver)

To use selenium with firefox you will need to install these items:

If you're using auth by credentials, you'll also need:

Example, that uses proxy credentials:

from seleniumwire import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

path_to_firefox_binary = '' # !!! set this variable !!!
path_to_geckodriver_binary = '' # !!! set this variable !!!

wire_options = {
  'proxy': {
    'http': 'http://pvtyproxies:[email protected]:5432',
    'https': 'http://pvtyproxies:[email protected]:5432',
    'no_proxy': 'localhost,127.0.0.1'
  }
}
binary = FirefoxBinary(path_to_firefox_binary)

options = Options()
options.headless = True
browser = webdriver.Firefox(
  options=options,
  firefox_binary=binary,
  executable_path=path_to_geckodriver_binary,
  seleniumwire_options=wire_options
)

browser.get("http://api.privateproxy.me:10738")
element = WebDriverWait(browser, 10).until(
  EC.visibility_of_element_located((By.CSS_SELECTOR, "pre"))
)
print(element.text)
browser.quit()

Example, that uses ip authorization:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

path_to_firefox_binary = '' # !!! set this variable !!!
path_to_geckodriver_binary = '' # !!! set this variable !!!
proxy_ip = '2.57.20.194'
proxy_port = 5432

profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", proxy_ip)
profile.set_preference("network.proxy.http_port", proxy_port)
profile.set_preference("network.proxy.ssl", proxy_ip)
profile.set_preference("network.proxy.ssl_port", proxy_port)
profile.update_preferences()

binary = FirefoxBinary(path_to_firefox_binary)
options = Options()
options.headless = True
browser = webdriver.Firefox(
  options=options,
  firefox_binary=binary,
  executable_path=path_to_geckodriver_binary,
  firefox_profile=profile
)
browser.get("http://api.privateproxy.me:10738")
element = WebDriverWait(browser, 10).until(
  EC.visibility_of_element_located((By.CSS_SELECTOR, "pre"))
)
print(element.text)
browser.quit()

Both examples launch firefox in headless mode, so the browser will stay hidden during execution of those examples.


python-selenium + Chrome(chromedriver)

To use selenium with chrome you will need to install these items:

Example that uses credentials authorization:

import os
import zipfile
import hashlib
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

proxy = "2.57.20.194:5432"
credentials = "pvtyproxies:ajd89akjdAdk"
path_to_chrome_binary = '' !!! set this variable !!!
path_to_chromedriver_binary = '' !!! set this variable !!!

def generate_extension(proxy, credentials):
  ip, port = proxy.split(':')
  login, password = credentials.split(':')
  manifest_json = """
  {
      "version": "1.0.0",
      "manifest_version": 2,
      "name": "Chrome Proxy",
      "permissions": [
          "proxy",
          "tabs",
          "unlimitedStorage",
          "storage",
          "",
          "webRequest",
          "webRequestBlocking"
      ],
      "background": {
          "scripts": ["background.js"]
      },
      "minimum_chrome_version":"22.0.0"
  }
  """

  background_js = """
  var config = {
          mode: "fixed_servers",
          rules: {
          singleProxy: {
              scheme: "http",
              host: "%s",
              port: parseInt(%s)
          },
          bypassList: ["localhost"]
          }
      };

  chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});

  function callbackFn(details) {
      return {
          authCredentials: {
              username: "%s",
              password: "%s"
          }
      };
  }

  chrome.webRequest.onAuthRequired.addListener(
              callbackFn,
              {urls: [""]},
              ['blocking']
  );
  """ % (ip, port, login, password)

  sha1 = hashlib.sha1()
  sha1.update(("%s:%s" % (proxy, credentials)).encode('utf-8'))
  filename = sha1.hexdigest() + ".zip"

  with zipfile.ZipFile(filename, 'w') as zp:
    zp.writestr("manifest.json", manifest_json)
    zp.writestr("background.js", background_js)

  return filename

extension_name = generate_extension(proxy, credentials)
options = Options()
options.binary_location = path_to_chrome_binary
options.add_extension(extension_name)
driver = webdriver.Chrome(
  executable_path = path_to_chromedriver_binary,
  options=options,
)
driver.get('http://api.privateproxy.me:10738/')
element = WebDriverWait(driver, 30).until(
  EC.visibility_of_element_located((By.CSS_SELECTOR, "pre"))
)
print(element.text)
driver.quit()
os.remove(extension_name)

Unfortunately, there are limitations while using credentials:

  • No headless mode
  • For each proxy + credentials set an extension must be generated and stored. We were not able to find an easier way.

Example that uses ip authorization:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

path_to_chrome_binary = '' # !!! set this variable !!!
path_to_chromedriver_binary = '' # !!! set this variable !!!
proxy = "2.57.20.194:5432"

options = Options()
options.binary_location = path_to_chrome_binary
options.headless = True
options.add_argument("--proxy-server=%s" % proxy)

driver = webdriver.Chrome(
  executable_path = path_to_chromedriver_binary,
  options=options,
)
driver.get('http://api.privateproxy.me:10738/')
element = WebDriverWait(driver, 30).until(
  EC.visibility_of_element_located((By.CSS_SELECTOR, "pre"))
)
print(element.text)
driver.quit()

Using Proxies with Node.JS Puppeteer

Puppeteer + Node.js + chrome

Currently we only have an example of how to use proxy with puppeteer and chrome.

For this you will need to install puppeteer with env variable PUPPETEER_PRODUCT=chrome:

PUPPETEER_PRODUCT=chrome npm install puppeteer

You will also need proxy-chain package:

npm install proxy-chain

Sample code:

const puppeteer = require('puppeteer');
const proxyChain = require('proxy-chain');

(async() => {
  const oldProxyUrl = 'http://pvtyproxies:[email protected]:5432';
  const newProxyUrl = await proxyChain.anonymizeProxy(oldProxyUrl);

  const browser = await puppeteer.launch({
    args: [`--proxy-server=${newProxyUrl}`],
  });

  const page = await browser.newPage();
  await page.goto('https://httpbin.org/ip');
  const element = await page.$('pre');
  const text = await page.evaluate(element => element.textContent, element);
  console.log(text);
  await browser.close();

  await proxyChain.closeAnonymizedProxy(newProxyUrl, true);
})();

Last Updated on December 12, 2023

Do you recommend the proxy service?

Click on a trophy to award it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Comment

Your email address will not be published. Required fields are marked *

en_USEnglish
Scroll to Top