lixroz Posted April 15, 2009 Share Posted April 15, 2009 Hey all - thanks in advance! Ok - this is the scene : i'm building a php web service that will receive requests ( in the form of XML )from my flash app - example request <request type="foo"/> and return results also in the same style. The as3 and php are communicating successfully BUT when I try retrieve the $_POST or $_REQUEST data sent by the flash app i get nothing. I have managed to retrieve the data by using file_get_contents('php://input') But this gives me a string that i assume is simply in a different encoding - this is what the previous line of code returns : request=%3Crequest%20type%3D%22foo%22%2F%3E I understand that there is a process of variable name/data pairing that occurs at some stage in the flash app because of the method that i'm using to send the data (URLVariables) and the result is the preceding "request=" in the string... (*sigh*) i'm sure that this is an issue of encoding conflicts and i also get the feeling that this is a simple fix - but i cant seem to get past this issue. My goal is to extract the attribute "type" to be switch cased but when i send this string to the SimpleXML constructor or simplexml_load_string functions i get this error : <br /> <b>Warning</b>: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: Entity: line 1: parser error : Start tag expected, '<' not found in <b>/var/www/flashresponder.php</b> on line <b>7</b><br /> <br /> <b>Warning</b>: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: request=%3Crequest%20type%3D%22foo%22%2F%3E in <b>/var/www/flashresponder.php</b> on line <b>7</b><br /> <br /> <b>Warning</b>: simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: ^ in <b>/var/www/flashresponder.php</b> on line <b>7</b><br /> Basically my question is this ; How can i get the XML in its original format to be parsed? And what reasons would prevent me from being able to use the simple technique of $_POST / $_REQUEST?? I hope that i have been clear in presenting my question and provided enough surrounding info - if further clarification is needed i'll be more than happy to add it. Once again thank you in advance! Quote Link to comment https://forums.phpfreaks.com/topic/154202-recieving-xml-from-as3/ Share on other sites More sharing options...
Axeia Posted April 16, 2009 Share Posted April 16, 2009 You want those %20 etc to convert to their normal values? (%20 being a space character iirc). Use PHP's URL decode function. Clueless as to why it wouldn't show up in $_POST or $_REQUEST though, did you try print_r( $_POST ) to see what is actually in there? Quote Link to comment https://forums.phpfreaks.com/topic/154202-recieving-xml-from-as3/#findComment-811480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.