Can be used to test the validity of an external resource
`` function isExternalUrlResource($url) { if(preg_match('!^(?<protocol>https?)?:?(?<slash>//)(?<host>[a-zA-Z0-9]+[.]+[a-zA-Z0-9-.]+)(?<port>:\d+)?(?<path>[a-zA-Z0-9/]+.*)?$!i', $url, $matches)) { return isset($matches['host']) && isset($matches['path']); }
return false;
}``