Hi,
i want to get n lines from $url after a certain string is found. I've tried this but
without positive results.
<?php
$url="http://some.url.com"; // some url
$fd = fopen ($url, "r");
$cur_line=1;
$query_str="Query"; $num_lines=6; $size=filesize($fd);
$size=100; // due to time to compute fileseize
echo '<li>Filesize='.$size; //debug
while (!feof ($fd) && $cur_line<=$num_lines)
{
$buffer = fgets($fd, $size);
$pos = strpos ($buffer, $query_str);
if ($pos)
{
echo '<li>POS='.$pos;
$res=fgets($fd, $pos+$cur_line+100);
echo '<li>'.$cur_line.' - '.htmlentities($res).'+';
$cur_line++;
}
}
fclose($fd);
?>