note 98036 deleted from function.filter-var by danbrown

From: Date: Fri, 21 May 2010 18:43:51 +0000
Subject: note 98036 deleted from function.filter-var by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169508@lists.php.net to get a copy of this message
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.

« previous php.notes (#169508) next »