Re: parsing html files

From: Date: Tue, 14 Nov 2000 21:46:01 +0000
Subject: Re: parsing html files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-25278@lists.php.net to get a copy of this message
> has anyone written a code fragment that parses textfiles ? > I want to search template files for expressions like {@VAR} and > store them into a database. No file manipulation is needed. > An Array for the VARs would be nice. > thanks a lot #something not unlike this: $filename = '/full/path/to/file'; $file = fopen($filename, 'r') or die("could not open $filename"); while (!feof($file)){ $line = fgets($file, 1000000); $var = strtok($line, '@VAR'); while ($var){ store_token($var); $var = strtok('@VAR'); } } function store_token($var){ #store $var in database }

« previous php.general (#25278) next »