My script.php accepts $_POST input and echos a string.
$theinput = $_POST['theinput'];
$output = //some processing;
echo $output;
I need the same code in another function in a different file second.php and don't want to repeat the code. But the first script script.php expects input as $_POST. My input in the function is not $_POST just a regular parameter.
function processinput($someinput){
//run the same script above,
//just the input is a parameter, not a `$_POST`
}
Any ideas how to do that? Is it possible to simulate a $_POST or something like that?