Note Submitter: Anonymous
----
<?php
if (filter_var('http://www.....com/abcd', FILTER_VALIDATE_URL) != FALSE)
{
echo "valid url";
}
else
{
echo "invalid url";
}
?>
Why is this valid? The host is not valid...
filter_var('http://www.abc_def.com/abcd', FILTER_VALIDATE_URL)
filter_var('http://www.abc#$%^&def.com/abcd', FILTER_VALIDATE_URL)
Also valid... Why? Because it's invalid... Do I something wrong?
I'm searching the best way to validate the host. Using regex is hard because of the new accepted i18n chars in domainname aka host. And using parse_url is just a nice explode, it does not check the parts for validity.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.