Quick Start
This is by far the fastest way to start using Shared Datacenter Proxies. You will make a request to https://ip.oxylabs.io
using a Shared Datacenter proxy from a random location. Don't forget to replace USERNAME
and PASSWORD
with your proxy user credentials.
curl -x dc.pr.oxylabs.io:10000 -U "customer-USERNAME:PASSWORD" https://ip.oxylabs.io
Let's make a request using a proxy from France. All you need to do is change the entry point address. Below is an example in cURL, and here you can all available country entry points.
curl -x dc.fr-pr.oxylabs.io:42000 -U "customer-USERNAME:PASSWORD" https://ip.oxylabs.io
What if you want to keep the same proxy for more than one request? Session control enables that. Just add sessid-abc12345
to your username string, where abc12345
can be any random string, and as long as you keep sending requests with this string (session ID), we will try our best to give you the same proxy IP.
curl -x dc.pr.oxylabs.io:10000 -U "customer-USERNAME-sessid-randomString123:PASSWORD" https://ip.oxylabs.io
If you have any additional questions, please contact your account manager or our support team at support@oxylabs.io.
To find out your usage statistics, generated traffic, request count and more, please login to dashboard.oxylabs.io. You can also add proxy users (subusers) and track their statistics separately.
Making requests
In this example a query to
ip.oxylabs.io
is performed from a random IP:
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:%s@dc.pr.oxylabs.io: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
Basic query only requires to pass username
and password
. No other parameters are needed. Such query will result in the request being made from a random IP address (proxy). Every new request will use a different proxy.
Parameter | Description |
---|---|
|
Username |
sessid |
Use session ID to keep the same IP address with upcoming queries. A session has no expiration time and will run infinitely. Random string; 0-9, A-z characters are supported. |
|
Password |
- required parameter
Selecting Country
In this example a query to
ip.oxylabs.io
is performed from a random IP address from Germany:
curl -x dc.de-pr.oxylabs.io:40000 -U "customer-USERNAME:PASSWORD" https://ip.oxylabs.io
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$proxy = 'dc.de-pr.oxylabs.io:40000';
$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:%s@dc.de-pr.oxylabs.io:40000' %
(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("dc.de-pr.oxylabs.io", 40000);
String query = Executor.newInstance()
.auth(entry, "customer-USERNAME", "PASS")
.execute(Request.Get("https://ip.oxylabs.io").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.de-pr.oxylabs.io:40000");
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('dc.de-pr.oxylabs.io', 40000, '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
All available entry points:
dc.pr.oxylabs.io:10000
dc.us-pr.oxylabs.io:30000
dc.de-pr.oxylabs.io:40000
dc.fr-pr.oxylabs.io:42000
dc.nl-pr.oxylabs.io:44000
dc.gb-pr.oxylabs.io:46000
dc.ro-pr.oxylabs.io:48000
Oxylabs Shared Datacenter proxies currently offers 6 different countries to choose from. Country-specific random proxy entry point will return new IP with every new request.
These are the available countries to choose from:
USA
dc.us-pr.oxylabs.io:30000
|
Germany
dc.de-pr.oxylabs.io:40000
|
France
dc.fr-pr.oxylabs.io:42000
|
|||
Netherlands
dc.nl-pr.oxylabs.io:44000
|
Great Britain
dc.gb-pr.oxylabs.io:46000
|
Romania
dc.ro-pr.oxylabs.io:48000
|
Session Control
German IP will be chosen for the first request, and then the same IP will be kept with new queries (session control):
curl -x dc.de-pr.oxylabs.io:40000 -U "customer-USERNAME-sessid-abcde12345:PASSWORD" https://ip.oxylabs.io
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$session = mt_rand();
$proxy = 'dc.de-pr.oxylabs.io:40000';
$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-sessid-$session:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
echo $output;
?>
import urllib.request
import random
username = 'USERNAME'
password = 'PASSWORD'
session = random.random()
entry = ('http://customer-%s-sessid-%s:%s@dc.pr.oxylabs.io:10000' %
(username, session, 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 java.io.*;
import java.util.Random;
import org.apache.http.HttpHost;
import org.apache.http.auth.*;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.fluent.Request;
import org.apache.http.client.methods.*;
import org.apache.http.impl.client.*;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.apache.http.util.EntityUtils;
class Client {
public static final String username = "USERNAME";
public static final String password = "PASSWORD";
public String session_id = Integer.toString(new Random().nextInt(Integer.MAX_VALUE));
public CloseableHttpClient client;
public Client() {
String login = "customer-"+username+"-sessid-" + session_id;
HttpHost entry_node = new HttpHost("dc.de-pr.oxylabs.io:40000");
CredentialsProvider credentials_provider = new BasicCredentialsProvider();
credentials_provider.setCredentials(new AuthScope(entry_node),
new UsernamePasswordCredentials(login, password));
client = HttpClients.custom()
.setConnectionManager(new BasicHttpClientConnectionManager())
.setProxy(entry_node)
.setDefaultCredentialsProvider(credentials_provider)
.build();
}
public String request(String url) throws IOException {
HttpGet request = new HttpGet(url);
CloseableHttpResponse response = client.execute(request);
try {
return EntityUtils.toString(response.getEntity());
} finally { response.close(); }
}
public void close() throws IOException { client.close(); }
}
public class Example {
public static void main(String[] args) throws IOException {
Client client = new Client();
try {
System.out.println(client.request("https://ip.oxylabs.io"));
} finally { client.close(); }
}
}
using System;
using System.Net;
class Client : WebClient
{
public static string username = "USERNAME";
public static string password = "PASSWORD";
public string session_id = new Random().Next().ToString();
public Client(string country_iso = null)
{
this.Proxy = new WebProxy("dc.de-pr.oxylabs.io:40000");
var login = "customer-"+username+"-sessid-"+session_id;
this.Proxy.Credentials = new NetworkCredential(login, password);
}
protected override WebRequest GetWebRequest(Uri address)
{
var request = base.GetWebRequest(address) as HttpWebRequest;
request.ConnectionGroupName = session_id;
return request;
}
}
class Example
{
static void Main()
{
var client = new Client();
Console.WriteLine(client.DownloadString("https://ip.oxylabs.io"));
}
}
require 'uri'
require 'net/http'
require 'net/https'
entry_node = 'dc.de-pr.oxylabs.io'
entry_port = '40000'
username = 'USERNAME'
password = 'PASSWORD'
session_id = Random.rand(1000000)
uri = URI.parse("https://ip.oxylabs.io/")
headers = {
'Accept-Encoding' => 'gzip'
}
proxy = Net::HTTP::Proxy(entry_node, entry_port, "#{username}-sessid-#{session_id}", password)
http = proxy.new(uri.host,uri.port)
if uri.scheme == 'https'
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
req = Net::HTTP::Get.new(uri.path, headers)
result = http.start do |con|
con.request(req)
end
puts result.body
Adding sessid
parameter with session ID string, for example sessid-abc12345
, enables session control. This means that the proxy will not change with the following requests. The example below shows how session control works:
- Your initial query with
sessid-random123
got assigned proxy IP address1.1.1.1
- As long as you keep sending new requests with the same session ID, the system will route your queries through
1.1.1.1
Response Codes
These are the most common response codes that you can get while using our residential proxy pool. If you receive any other response code, get in touch with your dedicated account manager for more information.
Response | Description |
---|---|
400 Bad Request |
Proxy server can return this error code if the request did not contain a host to connect to or there was a generic error when parsing HTTP request. Make sure your request is correctly formed and make sure to include URL in the request then try again. |
407 Proxy Authentication Required |
Request lacks proxy authentication information or username or password is invalid. Include Proxy-Authorization header in your request and make sure your username and password are correctly formed and then try again. |
500 Internal Server Error |
Proxy server has encountered an internal error. Retry request at a later time. |
502 Bad Gateway |
Proxy server received an invalid response from the upstream server. Retry request. Response Code 502 signifies that the IP assigned to your session ID is no longer available. If you encounter this error, there are two ways to work around it. The first is to wait for one minute and the system will automatically assign a new IP address to your session ID. Another approach is to simply switch to a new session ID (i.e. change the sessid parameter) – this way you will receive a new IP address. |
522 Timeout |
Proxy server did not receive a response from the upstream server in time. Retry request. |
525 No Exit Found |
Custom HTTP status code - this means proxy was unable to find an exit node which satisfies the request. Change request filter parameters or try again at a later time. |
Restricted URLs
To avoid abuse and unclear activities, some websites are restricted on our residential proxy network. The list includes, but is not limited to websites such as all Google domains including Play, linkedin.com, sonyentertainmentnetwork.com, all Apple domains, including iTunes, netflix.com and others. For more information please contact our support staff at support@oxylabs.io.