PHP already has a filter (FILTER_VALIDATE_URL) for validating urls using filter_var[0], however, it doesn't work on international URLs. You can also break up a url with parse_url()[1]<p>You might also want to look into PHP's curl wrapper which is a lot more powerful[2].<p>[0]<a href="https://secure.php.net/manual/en/function.filter-var.php" rel="nofollow">https://secure.php.net/manual/en/function.filter-var.php</a><p>[1]<a href="https://secure.php.net/manual/en/function.parse-url.php" rel="nofollow">https://secure.php.net/manual/en/function.parse-url.php</a><p>[2]<a href="https://secure.php.net/manual/en/book.curl.php" rel="nofollow">https://secure.php.net/manual/en/book.curl.php</a>