note 7836 added to gethostbyname
| From: | leingang at math dot harvard dot edu | Date: | Wed, 16 Aug 2000 20:41:59 +0000 |
| Subject: | note 7836 added to gethostbyname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-1984@lists.php.net to get a copy of this message | ||
To take spiceee's note to the next step, if you want to check whether a string $hostname that
"looks like" a hostname (i.e., matches the correct regexp) IS a valid host, do not check
on the truth value of gethostbyname($hostname)! This will always be true. Instead do
if (gethostbyname($hostname) == $hostname) {
echo "Bad boy! No such host!"
}
http://www.php.net/manual/function.gethostbyname.php