Making Requests
Basic query only requires to pass username and password. No other parameters are needed. Such query results in a request being made from a random IP address (proxy). Every new request uses a different proxy.

Query parameters

Parameter
Description
customer
Username
sessid
Session ID to keep the same IP in the upcoming queries. The session doesn't expire - you can keep it for unlimited amount of time. Random string, 0-9, and A-Z characters are supported.
password
Password
- required parameter

Code examples

In this example, a query to ip.oxylabs.io is performed from a random IP:
cURL
PHP
Python
Java
C#
Ruby
curl -x dc.pr.oxylabs.io:10000 -U "customer-USERNAME:PASSWORD" https://ip.oxylabs.io
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 'dc.pr.oxylabs.io:10000';
$query = curl_init('https://ip.oxylabs.io');
curl_setopt($query, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($query, CURLOPT_PROXY, "http://$proxy");
curl_setopt($query, CURLOPT_PROXYUSERPWD, "customer-$username:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
echo $output;
?>
import urllib.request
import random
username = 'USERNAME'
password = 'PASSWORD'
entry = ('http://customer-%s:%[email protected]:10000' %
(username, password))
query = urllib.request.ProxyHandler({
'http': entry,
'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io').read())
package example;
import org.apache.http.HttpHost;
import org.apache.http.client.fluent.*;
public class Example {
public static void main(String[] args) throws Exception {
HttpHost entry = new HttpHost("pr.oxylabs.io", 7777);
String query = Executor.newInstance()
.auth(entry, "customer-USERNAME", "PASS")
.execute(Request.Get("http://icanhazip.com").viaProxy(entry))
.returnContent().asString();
System.out.println(query);
}
}
using System;
using System.Net;
class Example
{
static void Main()
{
var client = new WebClient();
client.Proxy = new WebProxy("dc.pr.oxylabs.io:10000");
client.Proxy.Credentials = new NetworkCredential("customer-USERNAME", "PASSWORD");
Console.WriteLine(client.DownloadString("https://ip.oxylabs.io"));
}
}
require 'uri'
require 'net/http'
uri = URI.parse('https://ip.oxylabs.io/')
proxy = Net::HTTP::Proxy('pr.oxylabs.io', 7777, 'customer-USERNAME', 'PASSWORD')
req = Net::HTTP::Get.new(uri.path)
result = proxy.start(uri.host,uri.port) do |http|
http.request(req)
end
puts result.body
Copy link
Outline