';
?>
Test POST/SOAP Communication for CSW/WFS
asXML();
$headers = array(
"POST ".$path." HTTP/1.1",
"Content-type: text/xml; charset=\"utf-8\"",
"Cache-Control: no-cache",
"Pragma: no-cache",
"Content-length: ".strlen($datanew)
);
if ($doSOAP) {
$soapHead = "\n";
$soapHead .= "\n";
$soapHead .= "\n";
$soapFoot = "\n";
$soapFoot .= "\n";
$data = $soapHead.$data.$soapFoot;
$dataXMLObject = new SimpleXMLElement($data);
$datanew = $dataXMLObject->asXML();
$headers = array(
"POST ".$path." HTTP/1.1",
"Content-type: application/soap+xml; charset=\"utf-8\"",
"Cache-Control: no-cache",
"Pragma: no-cache",
"SOAPAction: \"run\"",
"Content-length: ".strlen($datanew)
);
}
//do curl connection and request
$out = getCURL($_REQUEST["onlineresource"],$datanew,$headers,$doSOAP);
}
//of class_connector
function getCURL($url,$data,$headers,$doSOAP){
$ch = curl_init ($url);
$arURL = parse_url($url);
$host = $arURL["host"];
$port = $arURL["port"];
if($port == ''){
$port = 80;
}
$path = $arURL["path"];
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
//or with own headers
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
if(CONNECTION_PROXY != ""){
curl_setopt($ch, CURLOPT_PROXY,CONNECTION_PROXY.":".CONNECTION_PORT);
}
if(CONNECTION_PASSWORD != ""){
curl_setopt ($ch, CURLOPT_PROXYUSERPWD, CONNECTION_USER.':'.CONNECTION_PASSWORD);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$useragent='GeoPortal Rheinland-Pfalz Testsystem';
curl_setopt ($ch,CURLOPT_USERAGENT,$useragent);
$file = curl_exec ($ch);
curl_close ($ch);
$e = new mb_exception("send_post_curl.php: url " . $url);
$e = new mb_exception("send_post_curl.php: send post " . $data);
$e = new mb_exception("send_post_curl.php: response " . $file);
return $file;
}
?>