This describes a little utility that I wrote in order to be able to get as much information as possible about an IP address using the MaxMind IP database residing on a server. It uses PHP as the scripting langauge.
Time for a short disclaimer..
.
The system I have built works fine for me - as always, your mileage may vary. There is no warranty with this product.
Fairly minimal:


<?php
header("Content-type: text/vnd.wap.wml");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""
. " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
?>
<wml>
<template>
<do type="prev" label="Previous">
<prev/>
</do>
</template>
<card id="card1" title=" - IP Information">
<p>
<?php
if ( isset ( $_REQUEST["IP"] ) && $_REQUEST["IP"] > '' )
{
$IP = $_REQUEST["IP"];
include("geoip.inc");
include("geoipcity.inc");
$gi = geoip_open("/path/to/GeoLiteCity.dat",GEOIP_STANDARD);
$record = geoip_record_by_addr($gi, $IP);
geoip_close($gi);
if ( $record )
{
print "Results for $IP<br/>";
foreach ($record as $key => $value)
{
if (isset($value))
{
echo "<u><b>".ucfirst($key)."</b></u><br/>$value<br/>\n";
}
}
print "<u><b>Hostname</b></u><br/>".gethostbyaddr($IP);
}
else
{
print '<pre>No data for that IP address</pre><p/>';
}
}
unset($IP);
unset($_REQUEST["IP"]);
?>
<input title="IP" name="IP" size="9" maxlength="15" type="text" format="15m" emptyok="false" value="" />
<anchor>
Go<go href="<?php print $_SERVER['PHP_SELF']; ?>" method="post">
<postfield name="IP" value="$(IP)" />
</go>
</anchor>
<br/>
<anchor>Main<go href="index.wml">
</go>
</anchor>
</p>
</card>
</wml>
MaxMind GeoIP® Select the GeoLite (Free/Open Source) version