1

I have the following HTTP data:

POST /forum/post.php HTTP/1.1
Accept: text/xml, text/html, text/plain, */*
Host: myhost.com
Content-Length: 752
Cache-Control: no-cache

LxINAXyIgvOZQBF28yt0/NYmrYy7/dWENDNdFybIqYSWxLS6Ystk1pHfFDEBOJPgfJMWPQwqojMTvLugMOD7ZeXm33WYxFnjhR8C+Q8es49bGp8GiBmU7o3VYvJYKHSsknRXoB9tp9hhnzBJ4RMOhLbIIk5i6QwR8sFHxqUsL+i/8mKJDAcDsXXZcJXlXqhRN7fCDqLb/vTmnSTm+qA2HWU1AsBAGpWoQycRr0BT62lI2H3WnKevGi7fePJdCKWmwp5yoztKYCI3QJKrJbt5f60zb8TR5JHEs2S8ne0e6mssV7N4A3rwE+/O08pfHAmsVVtotpdqkPHWEWr+S7te9r01grfJt6GY0ozH0BPqSkP98wUwlrD385sRzf8M8uOw3hI1DWliZl0ea2Dc4b/7zVfwsqHl94Hk5x2p6nzXaW0vEsAVrodNIIcv3ZGGEkk97BOsHXP1rvJNiQLuM/7D3X9WFX/cYYqnNrIW84rhtbhty04r6JH37G9hPDlHjiYAogQ0lpMubsTNaW35Gn9G7X/qaH4+uQtYDVt67graNB3dDEBQRfXHw/sOM57hlxU/o/Q52RgAcekhGABXsLtXH3Sd5rurYg+qjMtceK9hC37ylXOJ+0bTKVf/A8nLlMarTtGhQK+oG8Rx8juy/USlCvg4++dCXS3qr0pFC9u2tcLAgND0g3tcBN1kYw2Ca4TTxP5m932pBTict7PE0jAXITmOoV3MGFE9AsKMJAVUdRK0sg==

How can I capture the BASE64 data and write it to a file, I tried to dump the $_POST variables but I get nothing, tried with $_REQUEST or serialize($_REQUEST) and all I get is:

Array
(
)

How can I capture an undefined post data? Thanks!

bsteo
  • 1,738
  • 6
  • 34
  • 60
  • 1
    Possible duplicate of http://stackoverflow.com/questions/3362145/i-cant-read-my-post-http-requests-body-with-php? – Osiris Dec 10 '12 at 09:38
  • PHP only decodes *URL encoded* POST data into `$_POST`. For data of any other format, see ^ – deceze Dec 10 '12 at 09:39

1 Answers1

3

It can be found in $HTTP_RAW_POST_DATA:

echo $HTTP_RAW_POST_DATA;

Or:

echo file_get_contents("php://input");

Manual.

You can then write it to a file with file_put_contents() or any of the other methods to write to a file.

MrCode
  • 63,975
  • 10
  • 90
  • 112
  • MrCode, both methods work, thank you! Still waiting for stackoverflow to let me accept answer :) – bsteo Dec 10 '12 at 09:46