• Increase font size
  • Default font size
  • Decrease font size

Get Country By IP - Online Service for Websites

Have you ever wondered if it is possible to set the appropriate language of the web page based on the location of the guest?

YES, It is possible.

With this code, it is easy to find out a location of the guest from his IP address. This can be used than in the web language engine to show correct language mutation of the web page.

Here is an example of the webpage using our functionality: www.strongcv.com . The page has currently 2 language mutations - american and british english. The reason is simple. The webpage is creating document which is called Resume in the USA and CV in the Europe. Thanks to our "Get country by IP" functionality, it is possible to set up correct language for the guest.

If you have any questions, please do not hesitate to contact us at getcountrybyip(0)concordia.sk.


PHP GET

If you want to use this option to get the location, you only need to pass 2 arguments "ip" and "pass" to the following url:

http://rasco.concordia.sk/api/getCountryByIp_get.php

It will return the location of the IP address. For example "UNITED STATES".

Code example:

$pass = "password";
 
$country = file_get_contents('http://rasco.concordia.sk/api/getCountryByIp_get.php?ip='.$_SERVER['REMOTE_ADDR'].'&pass='.$pass);
 
echo $country;

You may check out the functionality by yourself, just click here.

Note: If the password is incorrect, the "error 01: incorrect password" message is shown.


PHP POST

If you want to use this option to get the location, you only need to pass through form element two POST variables "ip" and "pass".

It will return the location of the IP address. For example "UNITED STATES".

Code example:

<form action="http://rasco.concordia.sk/api/getCountryByIp_post.php" method="post">
IP: <input name="ip" type="text" />
Password: <input name="pass" type="text" />
<input type="submit" value="submit" />
</form>

You may check out the functionality by yourself, just click here.

Note: If the password is incorrect, the "error 01: incorrect password" message is shown.


PHP Webservice - Soap client

You may also want webservice to get location from the IP address. It is possible, you only need to use this WSDL file:

http://rasco.concordia.sk/api/webservice/getcountrybyip.wsdl

Code example:

$client = new SoapClient('http://rasco.concordia.sk/api/webservice/getcountrybyip.wsdl',array( 
 "trace"      => 1, 
 "exceptions" => 0));
 var_dump($client->__getFunctions());        //show functions/actions the service offers
 
 //create array of params that will be send to a webservice
 $params   = array(
 'ip' => '1.1.1.1',
 'password' => 'pass',
 );
 
 //view params
 var_dump($params);
 echo "-------";
 
 try { 
 $response = $client->__soapCall("getCountry", $params);
 echo "<strong>Request raw:</strong>".htmlspecialchars($client->__getLastRequest())."";
 echo "<strong>Response raw:</strong>".htmlspecialchars($client->__getLastResponse())."";
 echo "<strong>Response:</strong> $response";
 }
 catch (SoapFault $exception) {
 echo $exception;
 }

Tip: to debug your code that is using webservices easily, use SoapUI.


 

I want it!

To be able to use this functionality, you only need a password. Pay here only $19.98 and get it for a 6 month. If there is any technical problem we will help you to solve it or the money will be refunded.

 

New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1982 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2801 Hits
Inverse kinematics Machine Learning and Robotics
Read More 3709 Hits
gpsim tutorial Machine Learning and Robotics
Read More 9046 Hits

Most read content

A* search algorithm Machine Learning and Robotics
Read More 12060 Hits
gpsim tutorial Machine Learning and Robotics
Read More 9046 Hits

New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1982 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2801 Hits
Inverse kinematics Machine Learning and Robotics
Read More 3709 Hits
gpsim tutorial Machine Learning and Robotics
Read More 9046 Hits
Design by i-cons.ch / etosha-namibia.ch