HomeLanguagesPHP | geoip_asnum_by_name() Function

PHP | geoip_asnum_by_name() Function

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 )

    Parameters : The function accepts a single parameter as mentioned above and explained below :

  • $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).

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

RELATED ARTICLES

Most Popular

Dominic
32688 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7057 POSTS0 COMMENTS
Nicole Veronica
12198 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12293 POSTS0 COMMENTS
Shaida Kate Naidoo
7182 POSTS0 COMMENTS
Ted Musemwa
7447 POSTS0 COMMENTS
Thapelo Manthata
7160 POSTS0 COMMENTS
Umr Jansen
7150 POSTS0 COMMENTS