Hello, dear friends! Because I just moved to php, but I’m in urgent need to realize what I’m going to discuss below;
How to make a url check for validity?
URL must match the trace. occasion:

http://www.uztest.ru/ some text.gif

Some text may include any English. letters, numbers, slash (/), underscore (_) Thank you very much! HUGE!
I promise to learn regulars soon.

  • one
    I have never seen some text to include a slash, considering that these are file or directory names! - Palmervan

2 answers 2

preg_match("/^http:\/\/www.uztest.ru\/[0-9a-z_\/]*.gif/",$url); 
  • one
    Thank you very much - Anton Cherepkov
 $text = 'aaj66_/'; //$text = 'aaj 66_ /'; if(preg_match("/^[a-z0-9_\/.]+$/", $text)) { echo 'Ok'; } else { echo 'Bad'; } 

And at the expense of a slash would be better to think!

Instead of $text substitute - trim('/', $_SERVER['REQUEST_URI'])