Jump to content

Getting error with fseek


elyfrank

Recommended Posts

All I want is to be able to read a file until I find a word.

This is the code I wrote:

 

<?php

$word="blah";

$i=0;

$myFile = "http://www.example.com/file.txt";

$handle = fopen($myFile, 'r');

while($Data<>$word)

{

fseek($handle, $i+1);

$i=$i+1;

$Data = fread($handle, 4);

}

if ($Data = $word) echo $Data;

fclose($handle);

?>

 

And this is the error I am getting: "Warning: fseek() [function.fseek]: stream does not support seeking in ...." I keep getting this error repeatedly until it finds the word and print it.

 

 

Link to comment
https://forums.phpfreaks.com/topic/196544-getting-error-with-fseek/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.