Kevin,
You could also use the parse_url() function instead of explode(). The advantage is the function will spilt your URL into an array with the following elements: scheme, host, port, user, pass, path, query, and fragment. These elements coorespond to the URL as follows:
scheme://user:pass@host:port/path?query#fragment
More info can be found in the manual at:
http://www.php.net/manual/en/function.parse-url.php
HTH!!
Cheers,
Geoff A. Virgo