Oxylabs Documentation
English
Search
K

Country

Adding a cc flag to the authorization header enables one to specify which country IP to use to process the request. The value of this parameter is a case insensitive country code in 2-letter 3166-1 alpha-2 format. For example, DE for Germany, GB for the United Kingdom, and TH for Thailand proxy. See the examples for more details.
Here are a few examples of country parameters: cc-US cc-IT cc-TH cc-JP cc-AU cc-ES

Code example

In this example, a query to ip.oxylabs.io/location is performed from a random IP address from Germany:
cURL
PHP
Python
Java
C#
Ruby
curl -x pr.oxylabs.io:7777 -U "customer-USERNAME-cc-DE:PASSWORD" https://ip.oxylabs.io/location
<?php
$username = 'USERNAME';
$password = 'PASSWORD';
$country = 'DE';
$proxy = 'pr.oxylabs.io:7777';
$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-cc-$country:$password");
$output = curl_exec($query);
curl_close($query);
if ($output)
echo $output;
import urllib.request
username = 'USERNAME'
password = 'PASSWORD'
country = 'DE'
entry = ('http://customer-%s-cc-%s:%[email protected]:7777' %
(username, country, password))
query = urllib.request.ProxyHandler({
'http': entry,
'https': entry,
})
execute = urllib.request.build_opener(query)
print(execute.open('https://ip.oxylabs.io/location').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-cc-DE", "PASS")
.execute(Request.Get("http://ip.oxylabs.io/location").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("pr.oxylabs.io:7777");
client.Proxy.Credentials = new NetworkCredential("customer-USERNAME-cc-DE", "PASSWORD");
Console.WriteLine(client.DownloadString("https://ip.oxylabs.io/location"));
}
}
require 'uri'
require 'net/http'
uri = URI.parse('https://ip.oxylabs.io/location')
proxy = Net::HTTP::Proxy('pr.oxylabs.io', 7777, 'customer-USERNAME-cc-DE', 'PASSWORD')
puts proxy.get(uri)