At 00:49 02.03.2003, The Head Sage said: --------------------[snip]-------------------- >1. How can i set a script to run at a certain time?
*nix: use cron (man crontab) Windows: use the "at" command (help at) >2. How do i open a HTML file, extract all the text and then break up the >text into variables.. > >For example, i've got a HTML files which all have the same structure > >>> >Title: Magocracy >Author: TheHeadSage >E-Mail: [EMAIL PROTECTED] >Category: Comedy, Action >Keywords: Ilja, Magic, Ilkeria >Rating: PG-13 >Spoilers: None, origional story. >Summary: [Sumary here] > >Chapter Body ><< > > >How would i get all the text and break it up into the variables $title, >$author, $email >ect. So they can be insterted into the MySQL table under the approprate >colums. Using the layout you are showing: 1) Read the file 2) Split headers from body (delimited by an empty line) 3) make an array from the headers, splitting each line by ': ' // Disclaimer: untested // step 1 $hf = fopen($file, 'r') or die("Can't read $file"); $buffer=fread($hf, filesize($hf)); fclose($hf); // step 2 - now you have the chapter ready list($headers, $chapter) = preg_split("/(\n|\r|\r\n|\n\r){2,2}/s", $buffer); // step 3 $headers = preg_split("/(\n|\r|\r\n|\n\r)/s", $headers); $arkeywords = array(); // for the "array" method, see below foreach ($headers as $line) { list($var, $value) = preg_split('/:\s*/', $line, 2); // you may rather use an associative array instead of variable names // the "variable" method: $$var = $value; // the "array" method $arkeywords[$var] = $value; } You now have the "body text" in "$chapter", and either an associative array, or the named variables of the header lines. >3. How do i open a Word Document and extract all the text? You might try Word2X (see http://word2x.sourceforge.net/) Disclaimer - never used it, just been told about it by my friend Google (question was "Winword conversion Linux"). >Thats all the questions so far, any tips, comments, ideas, questions even >insults and flames are welcome! Nothing else? Ok, you got something to work on now I believe... *grin* >- Daniel "TheHeadSage" Spain >Founder of Voidsoft. >Server Administrator of The Void ...hopefully not... -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php