Re: XForms: Howw to handle method="post" with php

Martin Honnen <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Liberty Development
Message-ID <[email protected]>

Nils Dehl wrote:


> how can i get the submited data from a xform with method='post'?
> 
> the php global var $HTTP_RAW_POST_DATA does not exist.
> 
> i have no idea to get the browser generated xml data.

Is that PHP 5?
Then you could simply try alike

   $postedXML = new DOMDocument();
   $loaded = $postedXML->load('php://input');
   if ($loaded) {
     echo "<p>Received " . $postedXML->getElementsByTagName('*')->length 
. " elements.</p>\r\n";
   }
   else {
     echo "<p>Error parsing XML.</p>\r\n";
   }

$postedXML would be a DOMDocument, PHP 5's implementation of the W3C DOM 
Level 2 Core. See
   <www.php.net/dom>

Even with PHP 4.3 and later I think you can read from php://input but 
there you don't have DOM Level 2 support built in, there is only an 
extension that needs to be installed, called DOM XML.
But of course you could read php://input and pass that on to the XML 
parser for parsing, see
   <www.php.net/xml>

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.