Session Control
Adding the sessid parameter with a session ID string, for example, sessid-abc12345, to the user name enables session control. The proxy is not changed with the following requests and the session does not expire. The example below shows how session control works:
Your initial query with
sessid-random123got assigned proxy IP address1.1.1.1As long as you keep sending new requests with the same session ID, the system will route your queries through
1.1.1.1
Credentials list example:
Example represents a list of credentials that establish different sessions.
customer-USERNAME-sessid-iqwcp:PASSWORD
customer-USERNAME-sessid-tevab:PASSWORD
customer-USERNAME-sessid-6drwn:PASSWORD
customer-USERNAME-sessid-7eh7g:PASSWORD
customer-USERNAME-sessid-z7cao:PASSWORDCode examples
German IP is chosen for the first request, and then the same IP is kept with new queries (session control):
curl -x dc.de-pr.oxylabs.io:40000 -U "customer-USERNAME-sessid-abcde12345:PASSWORD" https://ip.oxylabs.io/location<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$session = mt_rand();
$proxy = 'dc.de-pr.oxylabs.io:40000';
$query = curl_init('https://ip.oxylabs.io/location');
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.de-pr.oxylabs.io:40000' %
(username, session, password))
query = urllib.request.ProxyHandler({
'http': entry,
'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io/location').read()Last updated
Was this helpful?

