[Mapbender-commits] r2073 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Fri Feb 8 07:55:06 EST 2008


Author: verenadiewald
Date: 2008-02-08 07:55:06 -0500 (Fri, 08 Feb 2008)
New Revision: 2073

Modified:
   trunk/mapbender/http/classes/class_connector.php
Log:
check if it is a xml string in function getHTTP()

Modified: trunk/mapbender/http/classes/class_connector.php
===================================================================
--- trunk/mapbender/http/classes/class_connector.php	2008-02-08 12:50:46 UTC (rev 2072)
+++ trunk/mapbender/http/classes/class_connector.php	2008-02-08 12:55:06 UTC (rev 2073)
@@ -158,9 +158,9 @@
 	}
 
 	private function getHTTP($url){
-	 	if ($this->httpType == "get") {
-	 		return @file_get_contents($url);	
-		}
+		if ($this->httpType == "get") {
+			return @file_get_contents($url);
+	 	}
 		else {
 			$urlComponentArray = parse_url($url);
 			$host = $urlComponentArray["host"];
@@ -179,9 +179,16 @@
 		    fputs($fp, "Content-length: " . strlen($this->httpPostData) . "\r\n");
 		    fputs($fp, "Connection: close\r\n\r\n");
 		    fputs($fp, $this->httpPostData);
+		    $xmlstr = false;
 		    while (!feof($fp)) {
-		    	$buf .= fgets($fp,4096);	
-		    }
+		    	$content = fgets($fp,4096);
+		    	if( strpos($content, '<?xml') === 0){
+		    		$xmlstr = true;
+		    	}
+		    	if($xmlstr == true){
+		    		$buf .= $content;
+		    	}
+			}
 		    fclose($fp);
 		    return $buf;			
 		}



More information about the Mapbender_commits mailing list