note 27100 added to ref.domxml
| From: | chuck at ludwigsen dot org | Date: | Fri, 22 Nov 2002 20:11:47 +0000 |
| Subject: | note 27100 added to ref.domxml | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39873@lists.php.net to get a copy of this message | ||
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>");
?>
--
http://www.php.net/manual/en/ref.domxml.php
http://master.php.net/manage/user-notes.php?action=edit+27100
http://master.php.net/manage/user-notes.php?action=delete+27100
http://master.php.net/manage/user-notes.php?action=reject+27100