I need to check for a file in two domains.
However, the format of the file that is written to the database does not match the one recorded on the server, for a few seconds delay (the format of the file name is shown in the example below).
File that exists on the server link
Uploading file link
As you can see, there is a difference in the last 2 characters (representing the seconds ... probably in the generation routine of this PDF, there is a delay of a few seconds that differs from the date recorded in the bank).
$dir01 = "https://dominio01.com.br/sistema/modulos/consulta/consultas/";
$dir02 = "https://dominio02.com.br/sistema/modulos/consulta/consultas/";
$documento = preg_replace("/[^0-9]/", "", $item['retCNPJCPF']);
$dataDoc = new DateTime($item['retDataHora']);
$filename = "consulta_".$documento."_".$dataDoc->format('dmYHis').".pdf";
if(file_exists($dir01.$filename)){
$lnkConsultas = "Consulta disponível no dominio 01";
}
elseif(file_exists($dir02.$filename)){
$lnkConsultas = "Consulta disponível no domínio 02";
}
I would like to know if it is possible to bring the files without the need to inform the seconds, and bring the occurrences of this ... changing the filename, and search through some regular expression. But I have no idea how to do this.
PS: I can not use "glob". This will return blank results because the files are in other domains.