<?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.
----
Server IP: 91.199.167.223
Probable Submitter: 94.214.169.162
----
Manual Page -- http://www.php.net/manual/en/function.filter-var.php
Edit -- https://master.php.net/note/edit/98036
Del: integrated -- https://master.php.net/note/delete/98036/integrated
Del: useless -- https://master.php.net/note/delete/98036/useless
Del: bad code -- https://master.php.net/note/delete/98036/bad+code
Del: spam -- https://master.php.net/note/delete/98036/spam
Del: non-english -- https://master.php.net/note/delete/98036/non-english
Del: in docs -- https://master.php.net/note/delete/98036/in+docs
Del: other reasons-- https://master.php.net/note/delete/98036
Reject -- https://master.php.net/note/reject/98036
Search -- https://master.php.net/manage/user-notes.php
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.