I needed to generate some data by taking the contents of a $ _POST and saving it to a file to process it later.
I did as follows:
$dados = $_POST;
$dados = var_export($dados, true);
$handle = fopen('posttemp.txt', 'a');
fwrite($handle, $dados);
fclose($handle);
So far so good, if I open the file posttemp.txt this is your content.
array (
'id' => '1832007',
'post' =>
array (
'codigo' => '39063',
'autor' => 'Christiano',
),
'conteudo' =>
array (
'id' => '2526167',
'dataInicio' => '2017-08-03 21:30:43',
'dataFinalizada' => '2017-08-03 21:30:47',
'status' => 'Publicado',
),
'autor' =>
array (
'codigo' => '37276',
'email' => '[email protected]',
'nome' => '1 Lift Gold',
'quantidade' => '1',
)
)
Now I need to get the content that was saved in posttemp.txt and then transform it back into a variable so that I can send it again via POST.