Re: Bug #2393: Can't use parse_url for url validation
| From: | Dominic J. Eidson | Date: | Tue, 28 Sep 1999 01:03:12 +0000 |
| Subject: | Re: Bug #2393: Can't use parse_url for url validation | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-11344@lists.php.net to get a copy of this message | ||
On 27 Sep 1999 bram@guts.nl wrote:
> <?
> $url=parse_url("http://this is no host");
> print $url["host"];
> ?>
> print's out :
>
> this is no host
>
> That's not a valid host.
Try a small wrapper function:
function check_url($url) {
$checked = parse_url($url);
if(gethostbyname($checked['host']) != $checked['host'])
return $checked;
else
return 0;
}
Nick
--
Dominic J. Eidson
"Baruk Khazad! Khazad ai-menu!" - Gimli
--------------------------------------------------------------------------------
http://www.the-infinite.org/ http://www.the-infinite.org/~dominic/