Hello all,
I'm working on porting some existing Perl code to PHP, but I'm having trouble finding a good match for the following snippet:
binmode STDIN;
read(STDIN,$buffer,$ENV{'CONTENT_LENGTH'});
Basically, the PHP file is called with the POST method, and then a binary stream is sent to it, which it is supposed to read into a buffer and manipulate before saving to a file.
Because I am working with an already-written applet that sends the data to the server, I cannot change the method in which the data is sent. I have to fill a buffer the same way.
I tried peeking in $HTTP_POST_VARS and $HTTP_ENV_VARS, though both are empty (no values at all). The headers indicate that the stream is coming across, as Content-Length matches the size of the stream, and Content-type is always "application/octet-stream."
Are there any PHP gurus out there that can help me with this? Once I fill the buffer with the data stream, the rest of the process is relatively easy.
Thanks in advance for any help!
-- Tails