note 14087 deleted from function.fgets by irc-html

From: Date: Thu, 03 Jan 2002 02:30:57 +0000
Subject: note 14087 deleted from function.fgets by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-24346@lists.php.net to get a copy of this message
to send the result read from a file to the browser without having to wait that all file has been comitted and the script ended, don't forget to call flush(); often enough, after you echo the data read by fgets(). Example: $fp = fopen("filename.html","r"); //or: $fp=fsockopen("www.yoursite.com",80); //fputs($fp,"GET /index.html HTTP/1.1\r\n"); //fputs($fp,"Host: www.yoursite.com\r\n\r\n"); while (!feof($fp)) {   $answer = fgets($fp,4096);   echo $answer;   //This flush will avoid the user to wait for the whole answer read   //from the $fp file or web site   flush(); }fclose($fp);

« previous php.notes (#24346) next »