Javascript / jQuery / PHP detect IP Address plus Country of Visitor - JSON Callback

Javascript PHP get real IP Address and Country

Why you need to detect your client IP Address and their location? You can do many things, such as: redirect them to a right page, pick a display language for them, block some countries that you don't like, set a good theme for your visitors, and show your clients some of your products / services base on their countries, city, location... etc.

We don't do spam.

API Supported JSON with JS Callback, PHP and other languages like .Net, C++, Java with SSL supported.

Javascript / jQuery get Client's IP Address & Location (Country, City)

You only need to embed a <script> tag with "src" link to our server. The server will return "codehelper_ip" as an Object / JSON, and you can use it right away.

// First, embed this script in your head or at bottom of the page.
<script language="Javascript" src="http://www.codehelper.io/api/ips/?js"></script>
// You can use it
<script language="Javascript">
    alert(codehelper_ip.IP);
    alert(codehelper_ip.Country);
</script>

                                

Block or Redirect Visitors if they come from some countries?

With PHP, Javascript example, you can get Country if your clients already. If they come from any country that you don't like, you can redirect them to your right URL.

Pick A Language, Set Themes for your visitors base on their country

Very easy, you have your client's country already. You can set your language = English if they come from US, set it to Vietnamese if they come from Vietnam. Redirect them to a chinese page if they come from China... etc

PHP get Real IP Address, Countries, City, State, Languages of Visitors

Both PHP and Javascript, you can detect real ip, visitor proxy, languages, state, city too. But for PHP Code, you have to download PHP Source Code from Github.

<?php
// Required Libraries
require_once("ip.codehelper.io.php");
require_once("php_fast_cache.php");

// New Class
$_ip = new ip_codehelper();

// Detect Real IP Address & Location
$real_client_ip_address = $_ip->getRealIP();
$visitor_location       = $_ip->getLocation($real_client_ip_address);

// Output result
echo $visitor_location['Country']."
"; echo "<pre>"; print_r($visitor_location);

Javascript & SSL? Other Languages like Java, .Net, C++?

Don't worry, we do support SSL and other languages with JSON return. Please check our community forum code example code.