Gethostbyname function to get IP name of a domainWe can get the ip address of the host server by using the domain name. For example we want to know the ip address of google.com. We can use the PHP function gethostbyname(). This function takes the domain name as input and return the dot formatted IPv4 address. Note that this function will contact dns server so available network must be healthy at the time of running of the script. Let us try the function first.
$result = gethostbyname('plus2net.com');