It depends on your definition of valid. Semantically valid, domain name resolves, etc.
The quick approach would be to use preg_match to test the url against a good regular expression to validate it's of the correct format. There appear to be some good examples on this thread PHP validation/regex for URL