postXML for PHP
July 03 2008
- 2 replies.
- This question is not yet resolved.
- This question was started by Thomas Stahl.
- Last post by Thomas Stahl.
member 03 July,
19:21 | I am trying to save a xopus document to a PHP/Symfony application. The javascript seems to be okay. After using rc = HTTPTools.postXML("/document/save", xmlDocument, "UTF-8"); my server php script returns a string which in turn arrives in my javascript save function. However, I do not know how I can get the XML content from PHP. - What is the name of the request variable? - Can anybody provide a snippet of PHP code that shows how the XML is read from the request? Something similar can be found somewhere else for Python. Don't know why you do not provide such essential information in your documentation. Some examples for the most used languages would be helpfull for your users and reduce your support efforts... |
Xopus Team 03 July,
19:55 | Snippet in PHP5Thomas, in here is a snippet that might help:$xmlstr = file_get_contents('php://input'); $xmlstr = iconv('UTF-16', 'UTF-8', $xmlstr); $dom = new domDocument; $dom->loadXML($xmlstr); $saved = $dom->save("document.xml"); echo "The number of bytes written :".$saved; We will ship better documented examples of saving to ASP, ASP.NET, JSP, PHP4, PHP5, Python, Ruby, Amazon S3 and WebDAV with the Xopus 3.2.12 release. |
member 03 July,
22:23 | Thank you, Laurens! This solved it. I never would have tried to read the raw HTTP "stream". But I did not use your line $xmlstr = iconv('UTF-16', 'UTF-8', $xmlstr); (didn't work) I guess the characterset conversion was not needed since I used postXML(..., ..., 'UTF-8') ? |
- support /
- forum /
- How To ... /
- postXML for PHP
React
Write a comment