- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 
                        //ip address checking function
//for real use should have a return value but example code
function testipaddress ($nametotest) {
    $ipaddress = $nametotest;
    $ipaddress = gethostbyname($nametotest);
    if ($ipaddress == $nametotest) {
        echo "No ip address for host, so host "
             . "not currently available in DNS and "
             . "probably offline for some time<BR>";
    }
    else {
        echo "good hostname, ipaddress = $ipaddress<BR>";
    }
}
                                 
        
            Пользовательские комментарии на php.net - это тот ещё кладезь. 
http://www.php.net/manual/en/function.gethostbyname.php
        
        
$ipaddress = gethostbyname($nametotest);
Гениально!!!!