Hi. I'm looking for a good, easy way to verify URLs provided by the user. My site has lots of forms where users enter URLs for various reasons. I'm not trying to verify that the URLs are valid, in the sense that they refer to a website or web page that exists... that level of error handled is already handled in the core functionality of each tool.
I'm looking for a way to "preprocess" the user input, and validate that what they have given me is actually a properly formatted URL. I suspect there may be potential for some xss vulnerability.
So what I want to do is verify the url in javascript, then verify it when it gets to the "action" php script, then do what the tool does and deal with the http response accordingly. Anything you give me here that is php, i can port to javascript easy enough. I'm looking for concepts more than specific code.