$req = urldecode($url) . urlencode($admin->char_decode(stripslashes($filter)));
     $mygml = new gml2();
     $mygml->parseFile($req);
     if (!empty($exportToShape)) {
         $filenamePrefix = md5(microtime());
         $mygml->toShape($filenamePrefix);
         header("Content-Type: application/json; charset=utf-8");
         echo '{"filename": "' . $filenamePrefix . '.zip"}';
     } else {
         header("Content-Type: application/json; charset=utf-8");
         echo $mygml->toGeoJSON();
     }
 } else {
     if ($command == "getFeature") {
         $admin = new administration();
         $wfsGetFeature = $admin->checkURL($wfsGetFeature);
         $url = $wfsGetFeature . "REQUEST=getFeature&VERSION=1.0.0&SERVICE=WFS&MAXFEATURES=20" . "&typename=" . $wfsFeatureTypeName;
         //."&propertyname=".$wfsGetFeatureAttr;
         //"&filter=<ogc:Filter><ogc:Not><ogc:PropertyIsNull><ogc:PropertyName>".$wfsGetFeatureAttr."</ogc:PropertyName></ogc:PropertyIsNull></ogc:Not></ogc:Filter>";
         #echo $url;
         $e = new mb_exception("URL: " . $url);
         $x = new connector($url);
         $data = $x->file;
         //$data = file_get_contents($url);
         $parser = xml_parser_create();
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
         xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
         xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
         xml_parse_into_struct($parser, $data, $values, $tags);
         $code = xml_get_error_code($parser);
         xml_parser_free($parser);
function getUpdateUrl($obj)
{
    global $con;
    $sql = "SELECT * FROM wfs WHERE wfs_id = \$1;";
    $v = array($obj->wfs);
    $t = array('i');
    $res = db_prep_query($sql, $v, $t);
    while ($row = db_fetch_array($res)) {
        $ContentOfColumn = $row[$obj->column];
        if ($obj->column == 'wfs_getcapabilities') {
            $n = new administration();
            $updateUrl = $n->checkURL($ContentOfColumn) . "VERSION=" . $row['wfs_version'] . "&REQUEST=GetCapabilities&SERVICE=WFS";
        } else {
            $updateUrl = $ContentOfColumn;
        }
        return $updateUrl;
    }
    return "";
}
 //get relevant data out of registry
 $sql = "SELECT wms_upload_url, wms_getcapabilities_doc, " . "wms_version, wms_getcapabilities, wms_getmap FROM wms " . "WHERE wms_id = \$1";
 $v = array($wms_id_own[$k]);
 $t = array('i');
 $res = db_prep_query($sql, $v, $t);
 $someArray = db_fetch_array($res);
 $url = $someArray['wms_upload_url'];
 $capDoc = $someArray['wms_getcapabilities_doc'];
 $version = $someArray['wms_version'];
 $capabilities = $someArray['wms_getcapabilities'];
 $getmap = $someArray['wms_getmap'];
 $getMapUrl = getMapRequest($wms_id_own[$k], $version, $getmap);
 // for the case when there is no upload url - however - we need the
 // url to the capabilities file
 if (!$url || $url == "") {
     $capabilities = $admin->checkURL($capabilities);
     if ($version == "1.0.0") {
         $url = $capabilities . "REQUEST=capabilities&WMTVER=1.0.0";
     } else {
         $url = $capabilities . "REQUEST=GetCapabilities&" . "SERVICE=WMS&VERSION=" . $version;
     }
 }
 //$url is the url to the service which should be monitored in this cycle
 //initialize monitoriung in db (set status=-2)
 echo "initialize monitoring for user: "******" WMS: " . $wms_id_own[$k] . $br;
 $e = new mb_notice("mod_monitorCapabilities_main.php: wms: " . $wms_id_own[$k]);
 $sql = "INSERT INTO mb_monitor (upload_id, fkey_wms_id, " . "status, status_comment, timestamp_begin, timestamp_end, " . "upload_url, updated)";
 $sql .= "VALUES (\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8)";
 $v = array($time, $wms_id_own[$k], "-2", "Monitoring is still in progress...", time(), "0", $url, "0");
 $t = array('s', 'i', 's', 's', 's', 's', 's', 's');
 $res = db_prep_query($sql, $v, $t);