Hi friends,
i have this code
<html>
<head>
<title></title>
</head>
<body>
<?php
$nurl = count($_POST['url']);
for($i=0; $i<$nurl; $i++) {
$string = file_get_contents($_POST['url'][$i]);
if ( preg_match_all("/title=\"My custom title\"/", $string, $matches) ) {
if (count($matches) > 0) {
echo 'FOUND<br />';
echo $_POST['url'][$i] . '<br />';
}
} else {
echo 'not found';
echo '<script type="text/JavaScript">setTimeout(\'window.close()\', 1000)</script>';
}
}
?>
</body>
</html>
I would want to print the URLs found by preg_match_all and close the windows if not found.
With my current code, the page is always closed.
I don't understand why. I've already tried the break to exit from for loop but isn't the solution.
Can you help me? thanks!
j.