Geotargeting

Certain websites (typically e-commerce stores and search engines) display different data to different users based on the geolocation of the IP used to make the request to the website. In cases like these, you can use the API’s geotargeting functionality to easily use proxies from the required country to retrieve the correct data from the website.

To control the geolocation of the IP used to make the request, simply set the country_code parameter to the country you want the proxy to be from and the API will automatically use the correct IP for that request.

For example: to ensure your requests come from the United States, set the country_code parameter to country_code=us.

Business and Enterprise Plan users can geotarget their requests to the following 69 countries (Hobby and Startup Plans can only use US and EU geotargeting) by using the country_code in their request:

Country CodeCountryPlans

us

United States

Hobby Plan and higher.

eu

Europe (general)

Hobby Plan and higher.

au

Australia

Business Plan and higher.

ae

United Arab Emirates

Business Plan and higher.

ar

Argentina

Business Plan and higher.

at

Austria

Business Plan and higher.

bd

Bangladesh

Business Plan and higher.

be

Belgium

Business Plan and higher.

br

Brazil

Business Plan and higher.

ca

Canada

Business Plan and higher.

ch

Switzerland

Business Plan and higher.

cl

Chile

Business Plan and higher.

cn

China

Business Plan and higher.

de

Germany

Business Plan and higher.

dk

Denmark

Business Plan and higher.

eg

Egypt

Business Plan and higher.

es

Spain

Business Plan and higher.

fi

Finland

Business Plan and higher.

fr

France

Business Plan and higher.

gr

Greece

Business Plan and higher.

hk

Hong Kong

Business Plan and higher.

hu

Hungary

Business Plan and higher.

id

Indonesia

Business Plan and higher.

ie

Ireland

Business Plan and higher.

il

Israel

Business Plan and higher.

in

India

Business Plan and higher.

it

Italy

Business Plan and higher.

jo

Jordan

Business Plan and higher.

jp

Japan

Business Plan and higher.

ke

Kenya

Business Plan and higher.

kr

South Korea

Business Plan and higher.

mx

Mexico

Business Plan and higher.

my

Malaysia

Business Plan and higher.

ng

Nigeria

Business Plan and higher.

nl

Netherlands

Business Plan and higher.

no

Norway

Business Plan and higher.

nz

New Zealand

Business Plan and higher.

pe

Peru

Business Plan and higher.

ph

Phillipines

Business Plan and higher.

pk

Pakistan

Business Plan and higher.

pl

Poland

Business Plan and higher.

pt

Portugal

Business Plan and higher.

ru

Russia

Business Plan and higher.

sa

Saudi Arabia

Business Plan and higher.

se

Sweden

Business Plan and higher.

sg

Singapore

Business Plan and higher.

th

Thailand

Business Plan and higher.

tr

Turkey

Business Plan and higher.

tw

Taiwan

Business Plan and higher.

ua

Ukraine

Business Plan and higher.

uk

United Kingdom

Business Plan and higher.

ve

Venezuela

Business Plan and higher.

vn

Vietnam

Business Plan and higher.

za

South Africa

Business Plan and higher.

bg

Bulgaria

Business Plan and higher.

hr

Croatia

Business Plan and higher.

cy

Cyprus

Business Plan and higher.

cz

Czechia

Business Plan and higher.

ee

Estonia

Business Plan and higher.

is

Iceland

Business Plan and higher.

lv

Latvia

Business Plan and higher.

li

Liechtenstein

Business Plan and higher.

lt

Lithuania

Business Plan and higher.

mt

Malta

Business Plan and higher.

ro

Romania

Business Plan and higher.

sk

Slovakia

Business Plan and higher.

si

Slovenia

Business Plan and higher.

ec

Ecuador

Business Plan and higher.

pa

Panama

Business Plan and higher.

Other countries are available to Enterprise customers upon request.

ZIP Code Geo targeting is currently supported for the Amazon domain. To find out more, please visit this link.

  • API REQUEST

<?php $url =
"http://api.scraperapi.com?api_key=APIKEY&url=http://httpbin.org/ip&country_code=us"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,
TRUE); curl_setopt($ch, CURLOPT_HEADER,
FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,
0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,
0); $response = curl_exec($ch); curl_close($ch); print_r($response);
  • PROXY MODE

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://httpbin.org/ip");
curl_setopt($ch, CURLOPT_PROXY, "http://scraperapi.country_code=us:APIKEY@proxy-server.scraperapi.com:8001");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
  • SDK Method

# remember to install the library: composer require scraperapi/sdk
<?php
  $client = new ScraperAPIClient("APIKEY");
  $result = $client->get("http://httpbin.org/ip", ["country_code" => us])->raw_body;
  print($result);

Last updated