Open In App

PHP | geoip_isp_by_name() Function

Last Updated : 07 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report
The geoip_isp_by_name() is an inbuilt function in PHP , which helps to get the ISP(Internet Service Provider) of the corresponding IP address .The function is available only for a commercial GeoIP ISP Edition user and gives a warning if the database is not found . Syntax :
string geoip_isp_by_name ( string $hostname )
    Parameters : The function geoip_isp_by_name() only accepts a single parameter as mentioned above and explained below :
  • $hostname : It is the only parameter accepted by the function. It is the hostname or IP address for which the function will generate the ISP( Internet Service Provider ) .
Return Value : The above function returns the Internet Service Provider(ISP) name on success and returns FALSE on failure( that is , if the database doesnot contains the address ) . Examples : Below is the implementation of above explained function . Program [sourcecode language="php"] <?php //PHP code implementing geoip_isp_by_name() function $sample = geoip_isp_by_name('www.example.com'); //checks if the ISP is valid if($sample) //prints the value of ISP for corresponding IP address echo "Required ISP is " . $sample ; ?> [/sourcecode] Output :

Required ISP is ICANN c/o Internet Assigned Numbers Authority

Reference : http://php.net/manual/en/function.geoip-isp-by-name.php

Next Article
Article Tags :

Similar Reads