';
?>
Test WFS-T operated by CCGIS
]*$", "", $data);
$parser = xml_parser_create(CHARSET);
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,CHARSET);
xml_parse_into_struct($parser,$data,$values,$tags);
$code = xml_get_error_code ($parser);
if ($code) {
echo "
Error " . $code . " (" . xml_error_string($code) . ")
";
}
xml_parser_free($parser);
$section;
$error=true;
$result="";
foreach ($values as $element) {
$element[tag] = sepNameSpace($element[tag]);
if(strtoupper($element[tag]) == "SERVICEEXCEPTIONREPORT" && $element[type] == "open"){
$section = "serviceexceptionreport";
}
if ($section == "serviceexceptionreport" && strtoupper($element[tag]) == "SERVICEEXCEPTION") {
$result = $element[value];
$error = true;
}
if(strtoupper($element[tag]) == "STATUS" && $element[type] == "open"){
$section = "status";
}
if ($section == "status" && strtoupper($element[tag]) == "SUCCESS") {
$result = "Success.";
$error = false;
}
}
if ($error) {
#echo "wfsWindow = open('', 'wfs', 'width=400, height=300, resizable, dependent=yes, scrollbars=yes');";
#echo "wfsWindow.document.open('text/html');";
#echo "wfsWindow.document.write('');";
#echo "wfsWindow.document.write('');";
#echo "wfsWindow.document.getElementsByTagName('body')[0].innerHTML = '".addslashes($result)."';";
#echo "wfsWindow.document.close();";
echo $result;
echo "";
}
else {
echo "";
}
function sepNameSpace($s){
$c = strpos($s,":");
if($c>0){
return substr($s,$c+1);
}
else{
return $s;
}
}
function sendToHost($host,$port,$method,$path,$data)
{
$buf = '';
if (empty($method)) {
$method = 'POST';
}
$method = strtoupper($method);
$fp = fsockopen($host, $port);
if (!$fp) {
echo "$errstr ($errno)
\n";
echo $fp;
}
else {
fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: " . strlen($data) . "\r\n");
fputs($fp, "Connection: close\r\n\r\n");
if ($method == 'POST') {
fputs($fp, $data);
}
while (!feof($fp)) {
$buf .= fgets($fp,4096);
}
fclose($fp);
}
return $buf;
}
?>