filter_var($url, FILTER_VALIDATE_URL); if (filter_var($url, FILTER_VALIDATE_URL) === FALSE) { die('Not a valid!!'); }