The follow is my code
<?php
ob_start();
$incoming = var_dump($_REQUEST);
$myFile = "testFile.txt";
$incoming = ob_get_content();
$fh = fopen($myFile, 'w');
fwrite($fh, $incoming);
fclose($fh);
?>
and it generates a file named testFile with the content sent to it..
So, if I navigate to http://example.com/uploads/upload_file.php?key=value
the text file will look like
array(1) {
["key"]=>
string(5) "value"
}
However, all I want in it, is just value
Ive attempted changing the write call to
fwrite($fh, $incoming[0]);
However, it will just write a to the file as a is from the array(1) portion of the string.
Change your code to this: