array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'function.geoip-id-by-name.php', 1 => 'geoip_id_by_name', ), 'up' => array ( 0 => 'ref.geoip.php', 1 => 'GeoIP Functions', ), 'prev' => array ( 0 => 'function.geoip-domain-by-name.php', 1 => 'geoip_domain_by_name', ), 'next' => array ( 0 => 'function.geoip-isp-by-name.php', 1 => 'geoip_isp_by_name', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/geoip/functions/geoip-id-by-name.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL geoip >= 0.2.0)
geoip_id_by_name — Get the Internet connection type
The geoip_id_by_name() function will return the Internet connection type corresponding to a hostname or an IP address.
The return value is numeric and can be compared to the following constants:
hostname
The hostname or IP address whose connection type is to be looked-up.
Returns the connection type.
Example #1 A geoip_id_by_name() example
This will output the connection type of the host example.com.
<?php
$netspeed = geoip_id_by_name('www.example.com');
echo 'The connection type is ';
switch ($netspeed) {
case GEOIP_DIALUP_SPEED:
echo 'dial-up';
break;
case GEOIP_CABLEDSL_SPEED:
echo 'cable or DSL';
break;
case GEOIP_CORPORATE_SPEED:
echo 'corporate';
break;
case GEOIP_UNKNOWN_SPEED:
default:
echo 'unknown';
}
?>
The above example will output:
The connection type is corporate