Good evening!
Personally, I'm generating a file .json
by PHP
, this file goes directly to the server (hosting). My problem is that as soon as I save, it gives a delay of a few minutes (2 minutes up). The code is working, it's only with this delay. Is this normal? Its size is 120 bytes
, sometimes even less.
But at the same time I generate an image, and it ends up being uploaded in seconds, as soon as I finish the process, it already appears in the database.
Note: I have already tried without the image, and it gives this delay too ...
Follow my code:
<? php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$nome = $_POST['nome'];
$bloco = $_POST['bloco'];
$apto = $_POST['apto'];
$rg = $_POST['rg'];
$empresa = $_POST['empresa'];
$veiculo = $_POST['veiculo'];
$placa = $_POST['placa'];
$date = date('d/m/y');
$hour = date('H:i');
// Array com dados
$visitante = array(
'nome' => $nome,
'bloco' => $bloco,
'apartamento' => $apto,
'rg' => $rg,
'empresa' => $empresa,
'veiculo' => $veiculo,
'placa' => $placa,
'foto' => $destino,
'data' => $date,
'hora' => $hour
);
$dados = $visitante;
$dados_json = json_encode($dados, true);
$file = fopen('dados/cadastro.json', 'w+');
fwrite($file, $dados_json);
fclose($file);
?>
Thank you in advance.