0

I made an ajax request to my server and sent some data(plain text) as a query string variable. I saved that data into a text file after using base64_decode() function in php which obviously saves gibberish.

Now I want to recover the plain text from the gibberish data saved in my text file. How do I do that?

Any help appreciated
test.php

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
data = '12345';
$.ajax({url:'sample.php?data='+data,success:function(){}});
</script>

sample.php

<?php

file_put_contents('file.txt','data='.base64_decode($_REQUEST['data'])."\r    \n",FILE_APPEND);

?>

0 Answers0