<input type="button" id="magicbtn" />
<div id="magichtml"></div>
<script>
$(document).on("click", "#magicbtn", function() {
$.ajax({
url: "/ajax/magic.php"
}).done(function(result) {
$( "#magichtml").html(result);
});
});
Array
(
[0] => Array
(
[host] => php.net
[type] => MX
[pri] => 5
[target] => pair2.php.net
[class] => IN
[ttl] => 6765
)
[1] => Array
(
[host] => php.net
[type] => A
[ip] => 64.246.30.37
[class] => IN
[ttl] => 8125
)
)
$count = 0;
$found = false;
$last_position = 0;
$last_string = "";
$search = "abrakadabra";
$fp = fopen('somefile.txt', 'r');
do {
fseek($fp, $last_position);
$last_string = "";
while (($buffer = fgets($fp)) !== false) {
$last_string .= $buffer;
}
if (strpos($last_string, $search) !== false) {
$found = true;
}
$last_position += strlen($last_string);
$count += 1;
sleep(2);
} while($found == false && $count < 10);
if ($found == true) {
echo "Текст найден!";
}