parse_url()

For later reference: parse_url() – pass it a URL string, and it returns an associative array of URL components. Useful for extracting host names without having to resort to regex.