The geoip_asnum_by_name() is an inbuilt function in PHP which helps us to get the Autonomous System Number (ASN). The function will help us to get the ASN by taking an IP address as an argument .
Syntax :
string geoip_asnum_by_name ( string $hostname )
- $hostname : It is the only parameter accepted by the geoip_asnum_by_name() function. It is the IP address or the hostname which the function accepts and returns the ASN(Autonomous Syntax Number).
Parameters : The function accepts a single parameter as mentioned above and explained below :
Return Values : It returns the ASN(Autonomous Syntax Number) on success and FALSE on failure.
Below program illustrate the geoip_asnum_by_name() function.
Program :
<?php // PHP code to illustrate the // geoip_asnum_by_name() function // The function accepts the host 'www.example.com' $asn = geoip_asnum_by_name( 'www.example.com' ); if ( $asn ) { //the function will print the ASN echo 'The ASN is:' . $asn ; } ?> |
Output:
The ASN is: AS15133 EdgeCast Networks, Inc
Reference : http://php.net/manual/en/function.geoip-asnum-by-name.php