Help $HTTP_RAW_POST_DATA

I’ve been trying to use this to get XML from flash into a php script
but it doesn’t seem to work.

is this for php version 5 only, or an extension maybe?

It’s not in the www.php.net site either

Howdy… :slight_smile:

A User Note section from the PHP manual says…(4.0.x manual)

$HTTP_RAW_POST_DATA –
You’ll usually access variables from forms sent via POST method by just accessing the associated PHP global variable.
However, if your POST data is not URI encoded (i.e., custom application that’s not form-based) PHP won’t parse the data into nice variables for you. You will need to use $HTTP_RAW_POST_DATA to access the raw data directly. (This should return a copy of the data given to the PHP process on STDIN; note that you wan’t be able to open STDIN and read it yourself because PHP already did so itself.)

file_get_contents(“php://input”);

why not just use $_POST
or
$HTTP_POST_VARS or whatever it was

because its raw data, unparsed post information. $_POST represents an array to extract values from parsed data

Yeah but he’s trying to send stuff from flash to php so it should work with $_POST…
or mby… I dunno there’s some special xml-sending-technique used here?

Some of the XML methods use $HTTP_RAW_POST_DATA not $_POST :wink:

I see :wink:

SENOC!!! i love you. the ‘input’ thing completely and literally saved me from losing the account i’m working on. and i thank you mucho muchissimo

the $HTTP_RAW_POST_DATA didn’t work for me.

The other input methods $_POST $HTTP_POST_VARS and all those won’t work when sending raw data into php. Because, for example: you know when you type something into your browser’s address bar, and after you press the ENTER key, it becomes something like this:

      %20michael%20%12monkeys

because the characters in the string you typed into your address bar are translated into http form (spaces become %20, etc)

if you use $_POST your xml will look like that^ by the time it arrives at the php script.

when Flash sends a LoadVars Object, then $_POST and $_REQUEST are okay,
but when flash sends XML it wants the data to stay RAW, without all those wierd decorations in it.

My first attempt at getting around this was using a LoadVars object to sneakily create a string that looked like XML, and sending the big pseudo-xml string to php using $_POST , and writing to the XML document. , I can laugh now at what I saw in the XML document when that little experiment was tried. actually it was kind of digusting.

Senoc’s solution is right now written on my studio wall in thick red magic marker