How to emulate an HTTP POST request using curl and commit the result to a text file? I already have a script called dump.php:
<?php
$var = print_r($GLOBALS, true);
$fp = fopen('raw-post.txt','w');
fputs($fp,$var);
fclose($fp);
?>
I did a simple test by doing:
curl -d 'echo=hello' http://localhost/dump.php
but I did not see the data that I dumped into the output file. I expected it to appear in one of the POST arrays, but it is empty.
[_POST] => Array
(
)
[HTTP_POST_VARS] => Array
(
)
source
share