Jump to content

Recieving xml from AS3


lixroz

Recommended Posts

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!

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.