Re: How to correctly validate url?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



it doesn't work. please see the results:

var_dump(filter_var('http://example.com', FILTER_VALIDATE_URL));

var_dump(filter_var('http://example', FILTER_VALIDATE_URL));

var_dump(filter_var('http://exämple.com', FILTER_VALIDATE_URL));

http://example should be false
http://exämple.com should be true -- please note the a with dots!

Br,
Tanel


18.01.2012 13:36, Vikash Kumar kirjutas:
Best way is to use filter_var:
http://in2.php.net/manual/en/function.filter-var.php

filter_var('http://example.com', FILTER_VALIDATE_URL)

On 18 January 2012 16:58, Tanel Tammik<keevitaja@xxxxxxxxx>  wrote:

Does anyone have a preg expression to validate the url which includes
these special characters like ÜÕÄÖ included?

Br,
Tanel


18.01.2012 12:21, Mokaddim Akm kirjutas:

  Sent from a handheld device

On 18-Jan-2012, at 4:05 PM, Tanel Tammik<keevitaja@xxxxxxxxx>   wrote:

  Hello,

how to correctly validate url? now the special local characters like
ÜÕÖÄ etc are allowed as well...


The generic URI syntax mandates that new URI schemes that provide for
the representation of character data in a URI must, in effect,
represent characters from the unreserved set without translation, and
**should convert all other characters to bytes according to UTF-8, and
then percent-encode those values**. This requirement was introduced in
January 2005 with the publication of RFC 3986. URI schemes introduced
before this date are not affected.[1]


[1] http://en.wikipedia.org/wiki/**Percent-encoding<http://en.wikipedia.org/wiki/Percent-encoding>

  Br,
Tanel

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux