Basic Reputation

You can use the IPLegit API to determine whether a IP Address is a known bad IP or a good IP. Our advanced database is constantly being updated with known proxies, host IPs and spammers.

PHP Code Example

<?php
$url = 'https://api.iplegit.com/info?ip=' . $_SERVER['REMOTE_ADDR'];
$json = file_get_contents($url);
$json_data = json_decode($json, true);

if($json_data["bad"] == true) {
	// IP is bad (Proxy/VPN/Bot). Block the IP here.
	echo 'You are not allowed to connect to this website.';
	die();
} 
?>
										

This code will block users who are considered bad with the message "You are not allowed to connect to this website."

jQuery Code Example

var ip = '1.1.1.1'

$.ajax({
	url: 'https://api.iplegit.com/info?ip=' + ip,   
	dataType: 'json',
	success: function(json) {
		alert('IP Type: ' + json.type);
	}
});
                                        
jQuery Code Example 2

var ip = '1.1.1.1'
$(function() {
	$.getJSON("https://api.iplegit.com/info?ip=" + ip,
		function(json) {
			if(json.bad) {
				document.write("You are using a bad IP");
			}
		}
	);
});
                                        
cURL Example

curl 'https://api.iplegit.com/info?ip=1.1.1.1'
                                        
										
JSON Output Example

{ 
   "ip":"1.1.1.1",
   "bad":true,
   "type":"hosting"
}
                                        
										

Full Detail

You can use the IPLegit API to determine a IP addresses, country, city, region, latitude, longitude andd internet service provider.

PHP Code Example

<?php
$url = 'https://api.iplegit.com/full?ip=' . $_SERVER['REMOTE_ADDR'];
$json = file_get_contents($url);
$json_data = json_decode($json, true);

echo $json_data["countryName"];
?>
										

This code will block users who are considered bad with the message "You are not allowed to connect to this website."

jQuery Code Example

var ip = '1.1.1.1'

$.ajax({
	url: 'https://api.iplegit.com/full?ip=' + ip,   
	dataType: 'json',
	success: function(json) {
		alert('Internet Service Provider: ' + json.isp);
	}
});
                                        
jQuery Code Example 2

var ip = '1.1.1.1'
$(function() {
	$.getJSON("https://api.iplegit.com/full?ip=" + ip,
		function(json) {
			document.write(json.city);
		}
	);
});
                                        
cURL Example

curl 'https://api.iplegit.com/full?ip=1.1.1.1'
                                        
										
JSON Output Example

{ 
   "ip":"1.1.1.1",
   "bad":true,
   "type":"hosting",
   "countryCode":"AU",
   "countryName":"AUSTRALIA",
   "latitude":-27.48333,
   "longitude":153.016663,
   "city":"SOUTH BRISBANE",
   "region":"QUEENSLAND",
   "isp":"CLOUDFLARENET - Cloudflare, Inc., US",
   "asn":13335
}