extract data from html

From: Date: Thu, 28 Jun 2001 06:27:42 +0000
Subject: extract data from html
Groups: php.general 
Request: Send a blank email to php-general+get-55454@lists.php.net to get a copy of this message
Hi, I keep receiving a lot of word documents the I need to extract and put into a mysql table. As of now, I do a cut and paste manually using a html from to a php script to dump it into the mysql table. Since the format is usually the same (most of the time) I am sure there should be another way to do this. I converted the word doc into a html file. Now the question is that I need to write a php script to open that file and read thru its contents. I am not that experienced in php but can understand the basics. The steps that I would take are : 1. Open the html file in read only mode 2. Start reading the html file till I encounter a <td> tag (I don't know how to do this) 3. Grab that data after the <td> tag (and then what?) 4. Repeat this process till encounter the </table> tag. If anyone could give me the steps in hard code and any other alternative what I would be happy. A Sample of the word doc (too big to attach) +---------------------------------------------------------------+ COS Zurich +---------------------------------------------------------------+ June July Aug Hotel Price +----+-------+-------+----------------+-------------------------+ 28 2 8 Arion Fr.1349 Inc Village Fr.1099 +----+-------+-------+---------------+--------------------------+ This is a table. Each table belongs to a different city. Each row has more than 2 hotels. What would be the best solution? TIA Adrian

« previous php.general (#55454) next »