GeoIPs Code

If you already have a GeoIPs account, you can send requests in any programming language.

PHP

This is an example of a call to the GeoIPs API using PHP. If the credentials are valid, the call will return a xml response into a variable.
<?php
	$ip 		= '8.8.8.8';
	$apikey 	= '36434385dd45665bhea769898a4e8ee2';
	$output		= 'xml';
	$timezone	= 'true';
	$hostname	= 'true';
	$service 	= 'http://api.geoips.com';
	$ch 		= curl_init();
	
	curl_setopt($ch, CURLOPT_URL, 
		    $service
		    .'/ip/'.$ip
		    .'/key/'.$apikey
		    .'/timezone/'.$timezone
		    .'/hostname/'.$hostname
		    .'/output/'.$output);
	curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);
	curl_setopt($ch, CURLOPT_TIMEOUT, 3);
	$data = curl_exec($ch);

	if(curl_errno($ch)) {
		print 'curl error: ' . curl_error($ch);
		return false;
	}
	else {	
		print $data;
		return $data;
	}
	curl_close($ch);
?>
Success,66.147.244.214,box714.bluehost.com,BLUEHOST INC.,NORTH AMERICA,NA,UNITED STATES,US,UTAH,UT,UTAH,PROVO,40.3402,-111.6073,MST
<response>
	<status>Success</status>
	<ip>66.147.244.214</ip>
	<hostname>box714.bluehost.com</hostname>
	<owner>BLUEHOST INC.</owner>
	<continent_name>NORTH AMERICA</continent_name>
	<continent_code>NA</continent_code>
	<country_name>UNITED STATES</country_name>
	<country_code>US</country_code>
	<region_name>UTAH</region_name>
	<region_code>UT</region_code>
	<county_name>UTAH</county_name>
	<city_name>PROVO</city_name>
	<latitude>40.3402</latitude>
	<longitude>-111.6073</longitude>
	<timezone>MST</timezone>
</response>

Contact

Contact Us

Contact Us Want to know more about GeoIPs and its services? For more information, please contact us using the following email address.