<?php
$fileID = @fopen("$SERVLET_SELF/ppowell.ChatServlet?message=" . urlencode('/n'), 'r');
if ($fileID) {
$content = @fread($fileID, HTMLRetriever::$MAX_URL_SIZE);
@fclose($fileID);
echo $content;
/*-------------------------------------------------------------------------------------
New 4/6/2004: Preserve each value of $content into a session variable to ensure
that if there is a disconnect with the servlet the cached content will display to
the user instead, not noticing much of a difference
--------------------------------------------------------------------------------------*/
$_SESSION['nick_content'] = $content;
} else {
echo $_SESSION['nick_content'];
}
?>
This code should allow for me to retain the value of $content in a session. The script that contains this code will be auto-refreshed from the client end. On occasions the URL called by @fopen() will hang up or be locked out; when that happens, I want to display the retained value of $content anyway.
The code I wrote I thought did that does not work, the session variable is empty upon return to this same script via auto-refresh. If the session is a bad idea, what should I use instead?
Thanx
Phil