fgets returns

From: Date: Sun, 30 Jul 2000 23:09:58 +0000
Subject: fgets returns
Groups: php.general 
Request: Send a blank email to php-general+get-9075@lists.php.net to get a copy of this message
Hi there! I am trying to write a little parser, which changes specific patterns in HTML Files to PHP code. Do read the users file into my parser and output it, I am using the following code. 1 2 $fd = fopen ("/tmp/inputfile.txt", "r"); 3 while (!feof($fd)) { 4 $buffer = fgets($fd, 4096); 5 6 echo $buffer; 7 } 8 fclose ($fd); 9 In line 5 I am starting to look at the $buffer and maybe make some string replacements. But, always when changing something on the $buffer, the browser doesn't recognize it as PHP Code. Example: $buffer = "<?echo 'Hi World!'?> <---- wouldn't work But if the line <?echo 'Hi World!'?> is present in the users file, the browser recognizes it just as usual. What am I doing wrong? Thanks for help. Simon Biela --- netdienste GbR internet & multimedia Geisselstrasse 19 50823 Koeln tel: +49 221 - 932 958 2 fax: +49 221 - 932 958 5 s.biela@netdienste.de http://www.netdienste.de red:pepper - das redaktionssystem www.redpepper.netdienste.de

« previous php.general (#9075) next »