Question

I'm developing a flash binary that execute an animation in some web pages, and during this time I want to get the current source code of the page and send it via a POST call.

To get current source code I execute some javascript like this :

src = ExternalInterface.call("function(){return document.documentElement.outerHTML;}");

At this point, no problem.

After that, as the source code could be very huge, I wanted to compress it, so I tried to work with BiteArray like this :

var dataSrc:ByteArray = new ByteArray();
dataSrc.writeUTFBytes(src); // xmlData is original XML string
dataSrc.compress();

At this point, how could I send this to some server script (here I use PHP) ?
I mean : I don't want to know how to send data to an URL (I will use URL Loader), but how should I set my variable ?

Directly dataSrc or data.toString() ?

Was it helpful?

Solution

After compressing with ByteArray, I just Base64Encode my result, transmit it to my server script, and in this script I Base64Decode and gzuncompress.

Why should I Base64Encode ? Because to transmit the data to the server, my data is converted in a string and doing this cause bit lose, and padding errors ... Base64Encode permits to convert each bit of my data in a valid string to communicate.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top