private static function split($url)
{
$pos = strpos($url, '://');
$scheme = substr($url, 0, $pos + 3);
$url = substr($url, $pos + 3);
if (false !== ($pos = strpos($url, '/'))) {
$host = substr($url, 0, $pos);
$url = substr($url, $pos);
} else {
// No path, only host
$host = $url;
$url = '/';
}
// At this point, we have $scheme, $host and $path
$root = $scheme . $host;
return array($root, $url);
}