Very simple. Get all geolocation information about an IP address in JSON, JSONP and CSV format through our API. Free usage with max 20 requests per minute for backend requests. For use on a website the limit is 10,000 requests per month. Free usage includes HTTP and secure HTTPS requests!
1. Create a function to call the visitor’s ipfunction visitor_ip(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];
}else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip = $_SERVER['REMOTE_ADDR'];
}
}
2. make API calls with curl$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://extreme-ip-lookup.com/json/".visitor_ip()."?key=Qn97RtiI2gwjStzJJjuG");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$result = curl_exec($ch2);
$data_ip = json_decode($result,true);
3. You can display data$isp = $data_ip['isp'];
$country = $data_ip['country'];
$countryID = $data_ip['country_code'];
$country = $data_ip['country'];
$region = $data_ip['region'];
$city = $data_ip['city'];
Here is a sample JSON Output from the server
{
"businessName" : "",
"businessWebsite" : "",
"city" : "Depok",
"continent" : "Asia",
"country" : "Indonesia",
"countryCode" : "ID",
"ipName" : "",
"ipType" : "Residential",
"isp" : "PT Telkom Indonesia",
"lat" : "-6.68917",
"lon" : "107.4",
"org" : "PT Telkom Indonesia",
"query" : "180.245.49.195",
"region" : "West Java",
"status" : "success",
"timezone" : "Asia/Jakarta",
"utcOffset" : "+07:00"
}
Now you have successfully created a fire lookup for free