IP Control
Instructions on how to rotate proxies for changing IP addresses and how to use static IPs for maintaining the same IP.
Proxy Rotation
Datacenter Proxies support proxy rotation. To use this feature you need to use port number 8000. With each new request you will use a random IP.
Code examples
curl -x dc.oxylabs.io:8000 -U "user-USERNAME:PASSWORD" https://ip.oxylabs.io/location #pip install requests
import requests
username = 'USERNAME'
password = 'PASSWORD'
proxy = 'dc.oxylabs.io:8000'
proxies = {
"https": ('https://user-%s:%s@%s' % (username, password, proxy))
}
response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)
print(response.content)//npm install axios
const axios = require("axios");
const https = require("https");
const client = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});
const username = 'USERNAME';
const password = 'PASSWORD'
client
.get("https://ip.oxylabs.io/location", {
proxy: {
protocol: "https",
host: "dc.oxylabs.io",
port: 8000,
auth: {
username: `user-${username}`,
password: password,
},
},
})
.then((res) => {
console.log(res.data);
})
.catch((err) => console.error(err));
Static Sessions
Depending on your billing type, you can utilize specific ports to maintain a consistent IP address for your requests.
Datacenter Proxies per IP
For the pay per IP billing type, use a specific static port to make requests. You will find port numbers in your proxy list.
Here is an example using a port (8001) for a static session:
curl -x dc.oxylabs.io:8001 -U user-USERNAME:PASSWORD https://ip.oxylabs.io/location Find more code examples in other code languages below:
curl -x dc.oxylabs.io:8001 -U user-USERNAME:PASSWORD https://ip.oxylabs.io/location #pip install requests
import requests
username = 'USERNAME'
password = 'PASSWORD'
proxy = 'dc.oxylabs.io:8001'
proxies = {
"https": ('https://user-%s:%s@%s' % (username, password, proxy))
}
response=requests.get("https://ip.oxylabs.io/location", proxies=proxies)
print(response.content)//npm install axios
const axios = require("axios");
const https = require("https");
const client = axios.create({
httpsAgent: new https.Agent({
rejectUnauthorized: false,
}),
});
const username = 'USERNAME';
const password = 'PASSWORD'
client
.get("https://ip.oxylabs.io/location", {
proxy: {
protocol: "https",
host: "dc.oxylabs.io",
port: 8001,
auth: {
username: `user-${username}`,
password: password,
},
},
})
.then((res) => {
console.log(res.data);
})
.catch((err) => console.error(err));
For a rotating or static session in a specific country, refer to Select country page.
Datacenter Proxies per traffic
For the pay per traffic billing type, a static port within the range of 8001 to 63000 (generate a random number within this range) will be used to make requests. Each request will receive a random IP from the pool, but the IP will remain consistent for the duration of the session.
Here is an example using a random port (35467) for a static session:
Find more code examples in other code languages below:
Last updated
Was this helpful?

