I'm having some trouble reading a text file from a remote server into a
string. The code is as follows:
if( !($fd = @fopen($ftp_url, "r")) ){
$error = true;
$error_msg = "Unable to connect to server.";
}
else {
$file_contents = fread($fd, 100000);
fclose($fd);
}
if( empty($file_contents) ){
$error = true;
$error_msg = "Did not read file.";
}
The problem is that the fread doesn't always succeed; about about half
the time the $file_contents string tests as empty. There is never a
problem with the fopen, and there doesn't seem to be any consistancy in
the failure... The same file may be loaded into the string on run one,
and missing the next. The remote server is NT-based.
Does anybody know what is going wrong here? I don't have to add any logic
to "wait" for the fread to complete, do I?
Thanks,
mth.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]