check if URL or IP address is valid