function getExternalRequest($id)
{
    for ($i = 0; $i < count($_SESSION["owsproxyUrls"]["url"]); $i++) {
        if ($id == $_SESSION["owsproxyUrls"]["id"][$i]) {
            $cUrl = $_SESSION["owsproxyUrls"]["url"][$i];
            $query_string = removeOWSGetParams($_SERVER["QUERY_STRING"]);
            if ($query_string != '') {
                $cUrl .= getConjunctionCharacter($cUrl) . $query_string;
            }
            $metainfo = get_headers($cUrl, 1);
            // just for the stupid InternetExplorer
            header('Pragma: private');
            header('Cache-control: private, must-revalidate');
            header("Content-Type: " . $metainfo['Content-Type']);
            $content = getDocumentContent($cUrl);
            #$content = matchUrls($content);
            echo $content;
        }
    }
}
function getCapabilities($request, $requestFull)
{
    global $arrayOnlineresources;
    global $layerId;
    header("Content-Type: application/xml");
    if (func_num_args() == 3) {
        //new for HTTP Authentication
        $auth = func_get_arg(2);
        $content = getDocumentContent($requestFull, $auth);
    } else {
        $content = getDocumentContent($requestFull);
    }
    $new = "href=\"" . HTTP_AUTH_PROXY . "/" . $layerId . "?";
    $pattern = "#href=\"" . OWSPROXY . "/[a-z0-9]{32}\\/[a-z0-9]{32}\\?#m";
    $content = preg_replace($pattern, $new, $content);
    #TODO: maybe do this by parsing xml rather then regexpr cause they are hungry ;-) - but fast
    $new = "href=\"" . HTTP_AUTH_PROXY . "/" . $layerId . "?\$1\"";
    $pattern = "#href=\"" . str_replace('?', '\\?', str_replace('/', '\\/', $request)) . "\"#";
    $content = preg_replace($pattern, $new, $content);
    echo $content;
}