What do you mean exactly by validating URL? You want to make sure the URL is in the right format like www.abc.com?
yes please. Is this enough, or do I need more... if(!preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i",$urlsubmitted)) { Echo"You must supply a valid URL."; Exit(); }
You can use parse_url() as well. function is_valid_url($url) { @extract(@parse_url($url)); return isset($scheme, $host); } PHP: (Untested) Might not be THAT safe though.
Thanks...I was looking for a quick fix on the web, and just couldn't find one. That is why I cam here. I am actually going to use the preg method followed up by file type verification. So I think I answered my own question.