Page 1 of 1

getting specific data from file

Posted: Fri Aug 22, 2003 8:59 am
by yaron
Hello all,
my program goal is to get info from text files and store it in db (mysql)
my input (the text file) is build like an xml file with tags.
a lot of line which looks like that.

<tagName name="parameterName" value="value" status="status" bla bla>

I need to write a script that will go line by line and first identify that the line is relevant (looks like I wrote)
then I have to get only the parameterName the value and the status (for storing).
So once I read the line I need to isolate this three elements.

I know how to open the file and read from it but can get the infromation I want. which functions can help me?
I hope the Q is understood
Thanks

Posted: Sat Aug 23, 2003 9:43 pm
by BDKR
Well, this isn't really a tough one. You just need to familiarize yourself with the php manual. Perhaps a little stristr and regex in there and you should be fine. Don't forget to also check out the file function if all of these entries are on their own line.

Cheers,
BDKR

Posted: Sat Aug 23, 2003 9:46 pm
by m3rajk
i suggest looking up preg_split. it should help in getting the relevant lines.
then use it again on the lines that are relevant to get the data