Ajax XML-Werte per POST an ein PHP-Script senden

mrno

Erfahrenes Mitglied
Hi,
ich hoffe ihr könnt mir weiterhelfen. Ich bin am verzweifeln. Ich sende per Ajax-Stream ein XML String an ein PHP Script. Mein Problem ist es, im PHP Script kommt nichts an.

Hier mein Code:

HTML:
		var body="<?xml version='1.0' encoding='UTF-8'?><class><test>123</test></class>";
		var url = "/plugins/tttdebugkit/tttsqllog.php";
		try {
			var xml_http = null;
			var ms_xml = new Array("Microsoft.XMLHTTP", "MSXML2.XMLHTTP",
					"MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0",
					"MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0",
					"MSXML2.XMLHTTP.2.0");

			var body = null;
			
			if (window.XMLHttpRequest) {
				try {
					xml_http = new XMLHttpRequest();
				} catch (e) {
				}
			} else if (window.ActiveXObject) {
				for ( var typ in ms_xml) {
					try {
						xml_http = new ActiveXObject(ms_xml[typ]);
					} catch (e) {
					}
				}
			} else {
				return false;
			}
			
			xml_http.open('POST', url, true);
			xml_http.setRequestHeader("Content-type", "text/xml");
			
			xml_http.onreadystatechange = function() {
					if (xml_http.readyState == 4 && xml_http.status == 200) {
						document.getElementsByTagName('body')[0].innerHTML=xml_http.responseText;
					}
			}
			xml_http.send(body);

PHP:
<?php
print_r($GLOBALS["HTTP_RAW_POST_DATA"]);
?>

leider ist die Variable HTTP_RAW_POST_DATA leer.

Hat einer eine Idee was ich falsch mache?
 
Moin,

versuch mal statt HTTP_RAW_POST_DATA ....file_get_contents('php://input') abzufragen.
Das Vorhandensein von HTTP_RAW_POST_DATA scheint von diversen PHP-Konfigurationseinstellungen abhängig zu Sein.
 
Zurück