note 27100 rejected from ref.domxml by rioter
| From: | rioter@php.net | Date: | Sat, 26 Jul 2003 14:17:43 +0000 |
| Subject: | note 27100 rejected from ref.domxml by rioter | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52702@lists.php.net to get a copy of this message | ||
Note Submitter: chuck@ludwigsen.org
----
I am trying to submit a DOM XML document from JavaScript to a PHP page. I can verify that the JS is
making the XML Document correctly and that the PHP script can process an XML Document correctly.
My problem is that it seems like either (a) the Javascript xmlHttp.send(xmlDoc) is not sending the
XML Document as a POST variable or (b) my PHP instance isn' t receiving POST variables.
I've tried $_POST, $_FILES, $HTTP_POST_VARS, you name it.
I would appreciate any help. Here is some code...
Javascript
---------------
var postStr = "<myrec>";
postStr += "<rowNumber>"+rowNumber+"</rowNumber>";
postStr += "<itemNumber>"+itemNumber+"</itemNumber>";
postStr += "<itemSize>"+itemSize+"</itemSize></myrec>";
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(postStr);
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
var url="test_validator.php";
xmlHttp.open("POST", url, false);
xmlHttp.send(xmlDoc);
var text=xmlHttp.responseText
var myOutput = document.getElementById('output');
myOutput.innerText=text;
PHP
------------
<?php
require "./domxml_xmlarray.php";
$xmlDoc = domxml_open_mem($_POST);
$xmlTree = domxml_xmlarray($xmlDoc);
print ("<pre>");
print_r ($HTTP_POST_VARS);
print_r ($_POST);
print_r ($_REQUEST);
print_r ($_FILES['userfile']['tmp_name']);
print_r ($xmlTree);
print ("</pre>");
?>