ipstack

Important Notice We have teamed up with ipstack.com to offer an even better IP Intelligence API.
To continue using the free GeoIPs service, please click the button on the rightbelow.Keep using the Free API

Script GeoIPs

Daca ai deja un cont de utilizator GeoIPs, poti trimite cereri in orice limbaj de programare.

PHP

Acesta este un exemplu de apel catre API-ul GeoIPs folosind PHP. Daca datele furnizate sunt valide, apelul va returna un raspuns in format xml prin intermediul unei variabila.

<?php
$ip 	  = '8.8.8.8';
$apikey   = '36434385dd45665bhea769898a4e8ee2';
$output	  = 'xml';
$timezone = 'true';
$hostname = 'true';
$service  = 'https://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);
?>
Propper Request,Success,The following results has been returned,200_1, 8.8.8.8,LEVEL 3 COMMUNICATIONS INC,NORTH AMERICA,NA,UNITED STATES,US,CALIFORNIA,CA,SANTA CLARA,MOUNTAIN VIEW,37.3801,-122.0865, unit_test,0.0723,0.76MB
<response>
<status>Propper Request</status>
<message>Success</message>
<notes>The following results has been returned</notes>
<code>200_1</code>
<location>
<ip>8.8.8.8</ip>
<owner>LEVEL 3 COMMUNICATIONS 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>CALIFORNIA</region_name>
<region_code>CA</region_code>
<county_name>SANTA CLARA</county_name>
<city_name>MOUNTAIN VIEW</city_name>
<latitude>37.3801</latitude>
<longitude>-122.0865</longitude>
</location>
<unit_test>
<elapsed_time>0.0536</elapsed_time>
<memory_usage>0.76MB</memory_usage>
</unit_test>
</response>

API-ul GeoIPs

Caracteristicile serviciului GeoIPs

  • identificare IP in timp real
  • API REST intuitiv
  • diferite tipuri de raspunsuri: XML, JSON, text
  • inregistrare usoara
  • integrare rapida in site-ul tau