I'm having trouble checking with remote files, the structure looks like this:
function endereco_existe($url) {
$h = get_headers($url);
$status = array();
preg_match('/HTTP\/.* ([0-9]+) .*/', $h[0] , $status);
$result = $status[1];
if($result == "200")
{
return true;//verdadeiro
}else
{
return false;//falso
}
}
This function works perfectly, but what happens when I call this function many times leaves the page very slow and does not open, I did the test taking this function and the problem does not appear,
This function is used in this context:
function lista($ini,$fin,$url,$ext,$op=0,$stp=1)
{
echo "<p id='rep'></p>";
echo "<script>function rep(url,i){var t = '<style>div.img{position: relative; width: 100%;}div.img > img{position: absolute; right: 3%; margin-right: 0px; top: 4%; margin-top: 0px; background-color: ; width:12%;opacity: 0.2; filter: alpha(opacity=20);}</style><div style=text-align:center; id=top>Lista '+i+'</div><div style=text-align:right;><a href=javascript:void(0); onclick=fechar();>[Fechar]</a></div><div class=img><video width=100% controls><source src='+url+' type=video/mp4>Seu Navegador não Suporta Repoduzir esse video baixe o Firefox ou Google Chrome</video><img src=logo.png></div>';document.getElementById('rep').innerHTML = t;} function fechar(){document.getElementById('rep').innerHTML =' ';}</script>";
for($i=$ini;$i<=$fin;$i++)
{
if($i<10)
{
$i = "0".$i;
}
if($stp==1)
{
if(endereco_existe($url.$i.$ext)==false)
{ break;}
}
echo "Lista 1".($i-$op)." ";
echo "<a href='#top' onclick='rep('".$url.$i.$ext."',".($i-$op).")'>Repoduzir</a>";
echo " | ";
echo "<a download='Lista ".$i.".mp4' href='".$url.$i.$ext."' target='_blank'>Baixar</a>";
echo "<br />";
}
}
It lists some videos, passed to the function that are listed by the suffix 01.02 and by that goes that are determined in the "for" (www.examplo.com/video01.mp4), I would like to know if there is any solution in this check if the file exists and in the listing thereof?