function CheckURI($parurl) { //VGR18032003
// inits
$result=TRUE;
// try to get URI
$filename = "$parurl";
$tobec=TRUE;
$fd = @fopen ($filename,'r');
if ($fd) { // si page trouvée
while ((!feof ($fd))and($tobec)) {
$ligne= fgets($fd, 4096);
if (!(strpos($ligne,'[404] Not Found')===false)) $tobec=FALSE; // stop as soon as this is encountered
$contents []=$ligne;
} // while lecture bloquante
fclose ($fd);
if ($tobec) { // file entirely read OK (note that we could stop after X first lines, the '404' message is not at the 345th line...
// nothing, result is TRUE already
// this block is in case you want to log anything like "last correct date where found the URI was OK"
} else { // we stopped before the end : 404 found
$result=FALSE;
}
} else { // page not found
$result=FALSE;
} // if page trouvée ou non
return $result;
} // CheckURI Boolean Function
for European Experts Exchange and Edaìn Works back to list of test scripts
Last update 2009-10-30 09:18:51
| Add This Article To: | |||
| |
|
|
|
| |
|
|
|