Re: Sorry. It seems I need to sleep more ;)
| From: | Kjartan Mannes | Date: | Fri, 01 Feb 2002 14:46:44 +0000 |
| Subject: | Re: Sorry. It seems I need to sleep more ;) | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11771@lists.php.net to get a copy of this message | ||
Friday, February 1, 2002, 3:46:20 PM, Sébastien Thüler wrote:
> Woops, sorry! I didn't even notice that ;)
> My problem is concerning gethostbyname() function. The PHP manual (French
> version ;) states that function "returns IP address of host".
> So I tried the following :
> $adresse = gethostbyname("http://www.blizzard.com");
> to get the IP address of http://www.blizzard.com in $adresse.
> The funny thing is that $adresse contains
> 'http://www.blizzard.com' !
> Anyone could help ?
If gethostbyname() fails to resolve the host it returns the hostname.
<?php
$hostname = "www.blizzard.com"
if (gethostbyname($hostname) == $hostname) {
print "Unable to resolve";
}
?>
Also you have to remove the http:// part as it only takes the host, not
urls as parameters.
--
Kjartan <kjartan@zind.net> (http://natrak.net/)
:: "Press any key... no, no, no, NOT THAT ONE!"