Mi rispondo....da sola
Codice PHP:
$url = "http://www.altrosito.net";
$file = "10049.pdf";
$path = "".$url."/documenti/".$file."";
$getHeaders = @get_headers($path);
if (!preg_match("|200|", $getHeaders[0])) {
$x =1;
while (!preg_match("|200|", $getHeaders[0])){
$path = "".$url."/documenti/".$x."/".$file."";
$getHeaders = @get_headers($path);
$x++;
}
}
echo $path;