function test_getCountryNameByHostName()
 {
     foreach ($this->hosts as $host => $expected) {
         $rv = fbGeoIP_Free_Binary::getCountryNameByHostName($host);
         $this->assertTrue($rv, "host='{$host}'");
         //			$this->assertEquals($expected, $rv, "host='$host'");
     }
 }
Beispiel #2
0
<?php

// $CVSHeader: _freebeer/www/demo/GeoIP.Free.Binary.php,v 1.3 2004/03/07 17:51:33 ross Exp $
// Copyright (c) 2002-2004, Ross Smith.  All rights reserved.
// Licensed under the BSD or LGPL License. See license.txt for details.
require_once './_demo.php';
require_once FREEBEER_BASE . '/lib/GeoIP/Free/Binary.php';
echo html_header_demo('fbGeoIP_Free_Binary Class');
echo "<pre>\n";
$ips = array('0.0.0.0', '10.0.0.1', '10.255.255.255', '127.0.0.1', '127.0.0.2', '127.255.255.255', '127.255.255.255', '172.16.0.0', '172.31.255.255', '192.168.0.0', '192.168.0.1', '192.168.255.255', '217.194.16.0', '217.194.16.1', '255.0.0.0', '255.255.255.254', '255.255.255.255', '9.20.0.0');
foreach ($ips as $ip) {
    $rv = fbGeoIP_Free_Binary::getCountryIDByIP($ip);
    printf("%-20s: '%s'\n", $ip, $rv);
}
echo "\n";
flush();
$hosts = array('localhost', 'sf.net');
foreach ($hosts as $host) {
    $rv = fbGeoIP_Free_Binary::getCountryIDByHostName($host);
    printf("%-20s: '%s'\n", $host, $rv);
}
?>
<address>
$CVSHeader: _freebeer/www/demo/GeoIP.Free.Binary.php,v 1.3 2004/03/07 17:51:33 ross Exp $
</address>

</body>
</html>
Beispiel #3
0
 function getCountryNameByHostName($name)
 {
     include_once FREEBEER_BASE . '/lib/ISO3166.php';
     $cc = fbGeoIP_Free_Binary::getCountryIdByHostName($name);
     $rv = fbISO3166::getCountryName($cc);
     return $rv ? $rv : $cc;
 }