Created
January 26, 2013 00:18
-
-
Save jmbarbier/4639100 to your computer and use it in GitHub Desktop.
Test liens stockés dans base de données, en PHP. Mai 2006.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
mysql_connect("ipserver","user","pass"); | |
mysql_select_db("database"); | |
echo "selected db... ready\n"; | |
$res = mysql_query("SELECT iddat,nomdat,linkdat,owner FROM resdat ORDER BY iddat"); | |
mysql_close(); | |
while($dat = mysql_fetch_array($res)) { | |
unset($result); | |
echo "Testing page $dat[iddat]..."; | |
exec("wget --spider '$dat[linkdat]' 2>&1",$result); | |
echo " OK\n"; | |
$resstr=""; | |
foreach($result as $line) $resstr.="$line\n"; | |
# echo $resstr; | |
if(preg_match("/erreur/i",$resstr)) { | |
echo "----- $dat[iddat] = ERREUR -----\n $dat[nomdat] ($dat[owner])\n"; | |
echo $resstr; | |
echo "----------------------------------------------------------\n"; | |
} else { | |
echo "----- $dat[iddat] = OK! -----\n"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment