Get Hostname IP


This code show how to get hostname IP in PHP

<?

function gethostip($hostname)
{
$aIPList = gethostbynamel($hostname);
$theIP = "$hostname IP is";
if (!$aIPList)
{
$theIP = "$hostname could not be resolved ";
}
else
{
foreach ($aIPList as $ip)
{

$theIP = $theIP . " $ip ";
}
}
return $theIP;
}
echo gethostip("www.gunungpring.com");

?>

Leave a Reply




This some posting which are related to this article :
  • No related posts
  • just read related article


    Some random post which may be interesting :
    this article is selected randomly