parse_url($url)

http://www.php.net/manual/tr/function.parse-url.php