JM
Работает на ура
http://www.phpclasses.org/browse/package/888.html
* URL class intended for http and https schemes
*
* This class allows you store absolute or relative URLs and access it's
* various parts (scheme, host, port, part, query, fragment).
*
* It will also accept and attempt to resolve a relative URL against an
* absolute URL already stored.
*
* Note: this URL class is based on the HTTP scheme.
*
* Example:
* <code>
* $url =& new URL('http://www.domain.com/path/file.php?query=blah');
* echo $url->get_scheme(),"\n"; // http
* echo $url->get_host(),"\n"; //
domain.com
* echo $url->get_path(),"\n"; // /path/file.php
* echo $url->get_query(),"\n"; // query=blah
* // Setting a relative URL against our existing URL
* $url->set_relative('../great.php');
* echo $url->as_string(); //
http://www.domain.com/great.php
* </code>