ソースを参照

WPS returns location and id's

Marek Strzała 11 年 前
コミット
f73e2686de
1 ファイル変更29 行追加46 行削除
  1. 29 46
      SE/superedit-OPEN_LAYERS_WPS.php

+ 29 - 46
SE/superedit-OPEN_LAYERS_WPS.php

@@ -32,6 +32,12 @@ function OPEN_LAYERS_WPS() {
 				if (method_exists($wps, $methodName)) {
 					$wps->$methodName($urlQuery);
 				}
+			}
+			else {
+				$wps = new WpsServer();
+				$wps->parseXMLRequest();
+				
+				
 			}
 			exit;
 			break;
@@ -583,7 +589,7 @@ function showOutput(response) {
     </script>
 	<?php
 
-
+/*
 	function get_location($ip) {
 		$content = @file_get_contents('http://api.hostip.info/?ip='.$ip);
 		if ($content != FALSE) {
@@ -604,6 +610,8 @@ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:
 $ip = '94.158.130.34';// biuro.biall-net.pl
 $location_info = get_location($ip);
 echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">location_info('.$ip.') (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($location_info);echo'</pre>';
+*/
+
 /*
 	$the_xml = file_get_contents('');
 	$feed = new SimpleXMLElement($the_xml);
@@ -618,6 +626,26 @@ echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:
 
 
 class WpsServer {
+	
+	public function parseXMLRequest() {
+		$entityBody = file_get_contents('php://input');
+		$table = array();
+		$content = $entityBody;
+		if ($content != FALSE) {
+			$xml = new SimpleXmlElement($content);
+			foreach($xml->children('wps', TRUE)->DataInputs->children('wps', TRUE) as $input) {
+				if(isset($input->children('wps', TRUE)->Data->ComplexData)) {
+					$table[] = $input->children('wps', TRUE)->Data->ComplexData;
+				} else if(isset($input->children('wps', TRUE)->Data->LiteralData)) {
+					$table[] = $input->children('wps', TRUE)->Data->LiteralData;
+				}
+			}
+			foreach($table as $value) {
+				echo($value);
+			}
+			
+		}
+	}
 
 	public function getCapabilitiesAction() {
 		echo '<?xml version="1.0" encoding="UTF-8"?>';
@@ -784,48 +812,3 @@ class WpsServer {
 		<?php
 	}
 }
-
-if ('WPS' == V::get('SERVICE', '', $_GET)) {
-
-	$req = V::get('REQUEST', '', $_GET);
-	$methodName = "request{$req}";
-	echo($methodName);
-	if (method_exists($WFSService, $methodName)) {
-	//	$wfsSService->$methodName();
-	} else {
-		// err
-	}
-}
-else {
-	$entityBody = file_get_contents('php://input');
-	if (!empty($entityBody)) {
-		$xml = new DOMDocument("1.1.0","UTF-8");
-		$xml->loadXML($entityBody);
-		//print_r($xml);
-		$locationNode = $xml->getElementsByTagNameNS("http://www.opengis.net/wps/1.0.0","ComplexData");
-		//print_r($locationNode);
-		$location = $locationNode[0];
-		//print_r($location);
-		
-		echo "Powinno dzialac";
-	//	echo($location[0]);
-	//print_r();
-
-	
-	}
-}
-
-
-class WFSService {
-	public function parseXmlPostRequest($xmlReq) {
-	}
-
-	public function requestGetCapabilities() {
-		?>
-		<?php
-	}
-
-	public function requestGetProcess() {// inne funkcje
-		
-	}
-}