Hi, I'm trying to check several links, check if they are working, I'm using the code below for this, but it only works when I test locally on my pc server, when I upload it to the hosting server it does not work properly .
On the hosting server the links that have ports type
link , does not show how even being operational.
They could help me, or even give me another strategy, because what I'm using takes a lot of time to load.
I'm using Mysql database to store links
function url_existe($url1) {
$ch = curl_init($url1);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return ($code == 200); // verifica se recebe "status OK"
}
while($lista_url_a = mysql_fetch_assoc($lista_url)) {
$url = $lista_url_a['url'];
$id_url = $lista_url_a['id'];
$url2 = $url;
if (url_existe($url2))
$atualiza_url = mysql_query("update url set status = 'OPERANTE' where id= $id_url");
else
$atualiza_url = mysql_query("update url set status = 'INOPERANTE' where id= $id_url");
}