- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 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>";
}
}
$ipaddress = gethostbyname($nametotest);
Гениально!!!!