Hi, all !
I'm want to write some program, that handles downloading from the site and can ajust the speed and stop downloading when i want it.
This is a code that should do it:
$fp = fopen($filename,"r");
function check($buf)
{
sleep(1);
if ( is_readable('/home/study/site.key') )
{
echo ($buf);
}
}
while (!feof($fp))
{
check(fread($fp,102400));
}
fclose($fp);
I limit speed to 100kb/s and expect the downloading to be stopped when i'll delete site.key file. There is no problem with the speed, but when i delete the file the download process does not stop.
Apparently, i miss something important in understanding of php streams.
I'll very grateful for any help.
Thank.