// try to determine the IP address of the hostname
// if the hostname is actually an IP, gethostbyname() will return it unchanged
// if the hostname cannot be resolved, it will have the same behavior
$ip = gethostbyname($address);
// check if the resulting IP is valid
if ($ip !== long2ip(ip2long($ip))) {
echo "Invalid hostname or IP address";
}
Maximum score
2 years ago
No comments:
Post a Comment