needaboloumma
New Member
First lets define a "URL" according to my requirements.The only protocols optionally allowed are \[code\]http://\[/code\] and \[code\]https://\[/code\]then a mandatory domain name like \[code\]stackoverflow.com\[/code\]then optionally the rest of url components (\[code\]path\[/code\], \[code\]query\[/code\], \[code\]hash\[/code\], ...)For reference a list of valid and invalid url's according to my requirementsVALID
- stackoverflow.com
- stackoverflow.com/questions/ask
- http://stackoverflow.com/questions/ask
- http://www.amazon.com/Computers-Int...pf_rd_t=101&pf_rd_p=1273387142&pf_rd_i=283155
- amazon.com/Computers-Internet-Books/b/ref=bhp_bb0309A_comint2?ie=UTF8&node=5&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=browse&pf_rd_r=0AH7GM29WF81Q72VPFDH&pf_rd_t=101&pf_rd_p=1273387142&pf_rd_i=283155
- http://test-site.com (filter_var reject this!!! I have domain names with dashes )
- http://www (php filter_var allow this, yes i know is a \[code\]valid\[/code\] url)
- http://www..des (php filter_var allow this)
- Any url with not allowed characters in the domain name